Time incorrect in calculated field

Comments

5 comments

  • Rainer Grabowski

    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

     

     

     

    0
    Comment actions Permalink
  • Ken DV

    Thank you Rainer. Inexplicably though, it's still off by one hour even though my timezone in Podio and on the PC are set correctly. I'm using the following code now:

    moment(@Start).tz(@Timezone).format('LLLL')

    0
    Comment actions Permalink
  • Rainer Grabowski

    But now the result is a ext string, not a date.
    Does it show now the rigth time?

    0
    Comment actions Permalink
  • Ken DV

    No, it is now one hour less than the actual time. Before it was off by 6 hours approx.

    0
    Comment actions Permalink
  • Rainer Grabowski

    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

     

     

    1
    Comment actions Permalink

Please sign in to leave a comment.

Powered by Zendesk