How to get the current date in a specific timezone in Workato

250 views Asked by At

How can I get the current date in a specific timezone in Workato? For an account that is configured as PST, when I run the following command

today.in_time_zone("Europe/Madrid")

it still returns the date in PST, not “Europe/Madrid”. Is this an error?

How can I get it to return the date in PST?

1

There are 1 answers

1
Sandeep Dingria On

Try now.in_time_zone("Europe/Madrid").

There are some weird interactions with today. From my observations, both take a default PST time but if you do today, it’s a date value where whereas if you use now, it’s the actual timestamp.

e.g.

  • today in PST is 31 Jan 2020. "31 Jan 2020".in_time_zone("Europe/Madrid") is still 31 Jan 2020.
  • now in PST is 23:43 31 Jan 2020. "23:43 31 Jan 2020".in_time_zone("Europe/Madrid") will convert it to the proper GMT offset.