Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Automation in JIRA | Correct Timezone

Mareli
Contributor
August 13, 2024

Hello All, 

I created this automation to update the summary when a field value changes:

Screenshot 2024-08-13 at 16.57.53.png

I have managed to get the date format the way I want it but I am struggling to set the correct time in the summary. 

In the Automation the date field referees to customfield_12025 which is the "Start Date ann Time (DP)" field: 

Screenshot 2024-08-13 at 17.00.38.png

As you can see the time is set to 2:30 PM.

But when I trigger the Automation the wrong time comes up, the time reads 12:30 instead of 14:30 or 2:30 PM:

Screenshot 2024-08-13 at 17.02.24.png

I've tried the following to get the correct time:

  1. {{issue.customfield_12025.format( "EEE, dd MMM yyyy HH:mm 'CAT'").convertToTimeZone(SAST)}}
  2. {{issue.customfield_12025.format( "EEE, dd MMM yyyy HH:mm 'SAST'").convertToTimeZone(SAST)}}
  3. {{issue.customfield_12025.format( "EEE, dd MMM yyyy HH:mm").convertToTimeZone(SAST)}}
  4. {{issue.customfield_12025.format( "EEE, dd MMM yyyy HH:mm").convertToTimeZone(CAT)}}
  5. {{issue.customfield_12025.format( "EEE, dd MMM yyyy HH:mm 'CAT'")}}
  6. {{issue.customfield_12025.format( "EEE, dd MMM yyyy HH:mm 'SAST'")}}

None of these seem to work they just leave out the date and time completely, like this:

Screenshot 2024-08-13 at 17.04.58.png

Any advice?

3 answers

1 accepted

3 votes
Answer accepted
Trudy Claspill
Community Champion
August 13, 2024

Hello @Mareli 

I have two recommendations.

First try swapping the time zone conversion and format functions. Both apply to a date/time value, but with the current order you are trying to apply timezone conversion to a formatted string. Try this order:

{{issue.customfield_12025.convertToTimeZone().format()}}

Second, I don't think the codes you are trying for time zone conversion are valid. In the documentation for the time zone conversion function...

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

...there is a link to a document from which you can get the valid entries to use for all the time zones.

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

I don't see SAST or CAT in that list.

Mareli
Contributor
August 13, 2024

Hi @Trudy Claspill 

IT WORKED! 

Thanks so much:

Screenshot 2024-08-13 at 17.42.41.png

I used this one: 
{{issue.customfield_12025.convertToTimeZone("UTC+02:00").format("EEE, dd MMM yyyy HH:mm")}}

Like # people like this
0 votes
QASIM ALOUDAT
Banned
September 30, 2024

Hello

@QASIM ALOUDAT 

I am expect the country must pay for local timezone

0 votes
Marc - Devoteam
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.
August 13, 2024

Hi @Mareli 

Could you try {{issue.customfield_12025.jiraDate}}

Mareli
Contributor
August 13, 2024

Hello @Marc - Devoteam 

This one did not work it does not give me the time and also the format is not correct

Screenshot 2024-08-13 at 17.36.39.png

Suggest an answer

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

Atlassian Community Events