# Relative Time + Experimental Code to Translate it?

**URL:** https://community.glideapps.com/t/relative-time-experimental-code-to-translate-it/34497
**Category:** Ask for Help
**Created:** [November 14, 2021, 11:49am UTC](https://community.glideapps.com/t/relative-time-experimental-code-to-translate-it/34497 "2021-11-14T11:49:57Z")
**Posts on this page:** 13
**Page:** 3

<div class="post-metadata">

### Author: ![L.M](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/l.m/32/46371_2.png) [@L.M](https://community.glideapps.com/u/L.M)
#### Post date: [November 20, 2021, 2:47pm UTC](https://community.glideapps.com/t/relative-time-experimental-code-to-translate-it/34497/41 "2021-11-20T14:47:03Z")

</div>

> [@George-Glide](#):
>
> `return new Date().toJSON()`

This

 ![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/8/e/8e2baec8bdbd0914cd7a0a04cdf0f0d3b7eba7bf.png)

---

<div class="post-metadata">

### Author: ![George-Glide](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/george-glide/32/22384_2.png) [@George-Glide](https://community.glideapps.com/u/George-Glide)
#### Post date: [November 20, 2021, 2:50pm UTC](https://community.glideapps.com/t/relative-time-experimental-code-to-translate-it/34497/42 "2021-11-20T14:50:00Z")

</div>

Interesting. @L.M That is what I get as well. What do you get when you try the other code below. Use either of the date columns for p1

```auto
return (typeof p1) + " - " + p1
```

---

<div class="post-metadata">

### Author: ![L.M](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/l.m/32/46371_2.png) [@L.M](https://community.glideapps.com/u/L.M)
#### Post date: [November 20, 2021, 2:54pm UTC](https://community.glideapps.com/t/relative-time-experimental-code-to-translate-it/34497/43 "2021-11-20T14:54:43Z")

</div>

> [@George-Glide](#):
>
> `eturn (typeof p1) + " - " + p1`

Huh… Like this, George? 🤔

 ![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/c/d/cdc06071b29d2c344fe4533e69875ba3c79a9aba.png)

---

<div class="post-metadata">

### Author: ![George-Glide](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/george-glide/32/22384_2.png) [@George-Glide](https://community.glideapps.com/u/George-Glide)
#### Post date: [November 20, 2021, 2:55pm UTC](https://community.glideapps.com/t/relative-time-experimental-code-to-translate-it/34497/44 "2021-11-20T14:55:46Z")

</div>

No. p1 should just be one of your date columns. Also you are missing the “R” in return.

---

<div class="post-metadata">

### Author: ![L.M](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/l.m/32/46371_2.png) [@L.M](https://community.glideapps.com/u/L.M)
#### Post date: [November 20, 2021, 2:58pm UTC](https://community.glideapps.com/t/relative-time-experimental-code-to-translate-it/34497/45 "2021-11-20T14:58:05Z")

</div>

That’s indeed what I tried first, but  
BTW, it’s “Return” not “eturn”, no mispelling in the code used, just the screen cap a little late

 ![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/8/1/8115537430fddc50a2705684bcc0f23d10c53d14.png)

---

<div class="post-metadata">

### Author: ![Darren\_Murphy](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/darren_murphy/32/47326_2.png) [@Darren\_Murphy](https://community.glideapps.com/u/Darren_Murphy)
#### Post date: [November 20, 2021, 2:59pm UTC](https://community.glideapps.com/t/relative-time-experimental-code-to-translate-it/34497/46 "2021-11-20T14:59:38Z")

</div>

You’re still missing the `r`…

 ![Screen Shot 2021-11-20 at 10.58.52 PM](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/0/e/0efd53f801d9e46fad722b1fae3c038a0f39a383.png)

---

<div class="post-metadata">

### Author: ![L.M](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/l.m/32/46371_2.png) [@L.M](https://community.glideapps.com/u/L.M)
#### Post date: [November 20, 2021, 3:12pm UTC](https://community.glideapps.com/t/relative-time-experimental-code-to-translate-it/34497/47 "2021-11-20T15:12:57Z")

</div>

No

 ![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/1/d/1dd9375c4a29e0797dac6c8099caf65d08c88acd.png)

---

<div class="post-metadata">

### Author: ![George-Glide](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/george-glide/32/22384_2.png) [@George-Glide](https://community.glideapps.com/u/George-Glide)
#### Post date: [November 20, 2021, 3:15pm UTC](https://community.glideapps.com/t/relative-time-experimental-code-to-translate-it/34497/48 "2021-11-20T15:15:53Z")

</div>

Make it all lower case: return

---

<div class="post-metadata">

### Author: ![L.M](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/l.m/32/46371_2.png) [@L.M](https://community.glideapps.com/u/L.M)
#### Post date: [November 20, 2021, 3:17pm UTC](https://community.glideapps.com/t/relative-time-experimental-code-to-translate-it/34497/49 "2021-11-20T15:17:40Z")

</div>

Aha!

 ![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/b/9/b949af2fa3a9218d787ff891f2263f9661321b0b.png)  
Yes, Sir!  
And accurate date/time

---

<div class="post-metadata">

### Author: ![George-Glide](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/george-glide/32/22384_2.png) [@George-Glide](https://community.glideapps.com/u/George-Glide)
#### Post date: [November 20, 2021, 3:22pm UTC](https://community.glideapps.com/t/relative-time-experimental-code-to-translate-it/34497/50 "2021-11-20T15:22:21Z")

</div>

Ok, so what Glide is “sending” as the value for any date parameter is dependent on the device’s local date settings. As @Darren_Murphy said we will have an issue with any date passed to plugins or javascript when using dates because the string format changes depending on the local format. There is nothing we can do here to fix it. I’ll report to the Engineers.

---

<div class="post-metadata">

### Author: ![L.M](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/l.m/32/46371_2.png) [@L.M](https://community.glideapps.com/u/L.M)
#### Post date: [November 20, 2021, 3:26pm UTC](https://community.glideapps.com/t/relative-time-experimental-code-to-translate-it/34497/51 "2021-11-20T15:26:43Z")

</div>

Thks, George. Happy to help.  
Do you happen to know if Glide stores user’s Time Zone whenever a “current user’s time” is set?  
To retrieve if later on.  
Thks.

---

<div class="post-metadata">

### Author: ![Jeff\_Hager](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/jeff_hager/32/43_2.png) [@Jeff\_Hager](https://community.glideapps.com/u/Jeff_Hager)
#### Post date: [November 20, 2021, 3:49pm UTC](https://community.glideapps.com/t/relative-time-experimental-code-to-translate-it/34497/52 "2021-11-20T15:49:15Z")

</div>

I don’t believe that glide stores the user’s timezone. That needs to be calculated on your end. Obviously several of those options below are plugins, so may or may not work correctly for you, but it gives you a few options to try.

> [@clock3 System/GMT Time - Solved!](https://community.glideapps.com/t/system-gmt-time-solved/27524/17):
>
> mmm, in our case the issue isn’t so much not knowing each users relative time, but more about dealing with the fact that we can have multiple users all trying to do the same thing at the same time, and because of sync delays they end up tripping over each other. For example, record X becomes up for grabs, and 3 users all try to claim it at the same time. Because the initial change is local to each users device, it appears to each one that they’ve claimed X, and so they move on to the next step…

> [@clock3 System/GMT Time - Solved!](https://community.glideapps.com/t/system-gmt-time-solved/27524/111):
>
> I am not Jeff but it is working for me. @Darren_Murphy

> [@YC for time zone change?](https://community.glideapps.com/t/yc-for-time-zone-change/34402/13):
>
> Here is a bit simpler way to get the timezone offset for the device using a Code/Javascript column. The use case I can think of is that if you allow anyone to schedule things and they are in different time zones, you would save both the date/time as well as the timezone offset when the user creates the event. This way you can always calculate the events’ time shown in the user’s time, by doing some math with the saved timezone offset of the event and the current users’ timezone offset. return…

> [@YC for time zone change?](https://community.glideapps.com/t/yc-for-time-zone-change/34402/18):
>
> That integer represents the number of hours between UTC and the users local time. For example, I’m in Singapore which is UTC+8. So for me it returns -8. To use it to convert UTC to users local time, you actually need to invert it first and then add it to a date/time using a math column. Here is how I’ve used it in one of my apps: [Screen Shot 2021-11-14 at 2.08.45 PM] Note that I adjusted the code slightly to invert the result, because I want to use it as a correction: return -(new Date().g…

---

<div class="post-metadata">

### Author: ![George-Glide](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/george-glide/32/22384_2.png) [@George-Glide](https://community.glideapps.com/u/George-Glide)
#### Post date: [November 23, 2021, 8:22pm UTC](https://community.glideapps.com/t/relative-time-experimental-code-to-translate-it/34497/53 "2021-11-23T20:22:31Z")

</div>

@L.M If you use Google Sheets you could create two columns and use these formulas on row one of each column. Obviously, change the column references to the two date columns. Then use those two columns in your DateDiff p1 and p1 parameters.

```auto
={"StartISO";ARRAYFORMULA(IF(LEN(F2:F),TEXT(F2:F,"yyyy-MM-ddTHH:mm:ss.000Z"),""))}
={"EndISO";ARRAYFORMULA(IF(LEN(G2:G),TEXT(G2:G,"yyyy-MM-ddTHH:mm:ss.000Z"),""))}

```

[Previous page](https://community.glideapps.com/t/relative-time-experimental-code-to-translate-it/34497.md?page=2)
