Time incorrect in calculated field
I have a Start field which is a date range and lists March 11th, 2016 at 11 AM. However, if I try to reference this in a calculated field as such: @Start.toLocaleDateString()
The result is Friday, March 11, 2016 16:00:00
I tried setting the timezone manually to match my time zone, but this did not work.
-
Hi Ken,
what exactly do you want to do in the calculation field? If only want to show the same date/time as in the date field in the SAME item
@start
should do it. If it shows the wrong time try
moment(@Start).tz("Europe/Berlin").toDate()
In .tz() enter your timezone (if the name of the city has 2 words concatenate the words: .tz("America/New_York"))
Rainer
-
Such time calculations are sometimes rather cumbersome cause of the timezones, DST and cause the Podio Server time = UTC.
Maybe this helps: First get the difference (incl. DST) between your timezone UTC and UTC 0 (for me it's UTC+1)
var tc = parseFloat(moment(@start).tz("Europe/Berlin").format("ZZ"))/100;
The result is a number. Then add or substract this number to/from the date (just test what fits for your tz):
moment(@start).add(tc,'hours').toDate()
This displays it in date format.
Rainer
Please sign in to leave a comment.
Comments
5 comments