Why is my date-time smart value resolving to 4 hours past the current time?

Phil Bustin
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 17, 2023

The current time was 10:30 AM.  

{{now. shortDateTime}} in a text field resolved to 2:30 PM

A setting in System is:

Default user time zone (GMT-05:00) New York

1 answer

1 accepted

1 vote
Answer accepted
Trudy Claspill
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
April 17, 2023

Dates and times are stored in Jira Cloud in GMT.  You are seeing the current GMT time.

With Daylight Savings Time in the U.S., New York is actually only 4 hours behind GMT. It is 5 hours behind GMT when Standard Time is in effect.

Phil Bustin
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 19, 2023

Thank you for your answer, but I am unfortunately not understanding it. 

The correct time displays in date/time fields after post-transition actions use %%CURRENT_DATETIME%%, but in an automation that resolves smart value {{now. shortDateTime}}, in a text field, the time displayed in the text field is 5 hours later.  4 hours later would still not be usable. 

The setting I see in Sandbox > System is Default user time zone (GMT-05:00) New York, which I interpret as NY (Eastern) time.  A discrepancy of one hour doesn't solve my problem, and if that were the problem, I would not know how to correct it.

Trudy Claspill
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
April 19, 2023

You stated:

 

The current time was 10:30 AM.  

{{now. shortDateTime}} in a text field resolved to 2:30 PM

That is a difference of 4 hours.

For consistency date/times are stored in the Jira database as GMT/UTC, so date/time smart values like {{now}} return the GMT/UTC time. That is why your smart value is showing the current time in terms of GMT/UTC.

You said the Default User Time Zone is (GMT-05:00). The stated timezones don't adjust for Daylight Savings Time. The difference between GMT and New York during Standard Time months in the U.S. is 5 hours. During Daylight Savings Time months the difference is only 4 hours. You can see this with apps/websites that show you the time in different timezones, such as

https://dateful.com/time-zone-converter

So, while the time per your time zone setting (GMT -5:00) is 10:xx am, the value for {{now}} will be 2:xx pm during Daylight Savings Time months. That is the answer to the question you asked. 

 

You have not stated what the problem is with the field displaying the GMT/UTC time rather than the equivalent time for your timezone preference.

If you want to convert the value from GMT/UTC to a specific time zone before storing it in the text field you can use the  convertToTimeZone function documented on this page.

Example: 

{{now.convertToTimeZone("Australia/Sydney").shortTime}}

Since the users of your system may have set different timezone preferences than the default, if you do convert the value to a specific timezone you may want to tack on text in that field that indicate which time zone the value is for.

 

(Side note: when you are viewing issues in the UI, Jira automatically converts the values shown in date/time fields from the stored UTC/GMT value to the time zone preference selected by the user.)

 

Phil Bustin
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 19, 2023

Thank you.  While I'm waiting for my Tech Support to allow the URL in the link provided for valid inputs for time zone, if you know the input for US Eastern, please provide it.  My guess didn't work: {{now.convertToTimeZone("New York").shortTime}}

Trudy Claspill
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
April 19, 2023

America/New_York

Like Phil Bustin likes this
Phil Bustin
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 19, 2023

:-)

Ben Gallant September 27, 2023

Is there an official timezone list like the above "America/New_York" suggested above by @Trudy Claspill ? I'd love to see it. 

Ben Gallant September 27, 2023

Never mind, I think I figured it out: 

https://en.wikipedia.org/wiki/List_of_tz_database_time_zones

Trudy Claspill
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
September 27, 2023

@Ben Gallant 

In the Jira documentation regarding smart values for date/time

https://support.atlassian.com/cloud-automation/docs/jira-smart-values-date-and-time/

...under the section for the convertToTimeZone function there is a link to the Time zone values that are valid.

http://joda-time.sourceforge.net/timezones.html

Screenshot 2023-09-27 at 6.05.43 AM.png

Like Ben Gallant likes this
Ben Gallant September 27, 2023

Thanks @Trudy Claspill 

I wanted the date to render as "Thursday, June 28, 2023 at 4:00pm EST" and was able to accomplish this for a custom date/time field. 

{{issue.customfield_10928.convertToTimeZone("America/New_York").format("EEEE, MMMM d, yyyy 'at' h:mma")}}

And it works perfectly! I'm using it in an automated email. 

Like Bhaargavi Natarajan likes this

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events