Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

ConvertToTimeZone not working

Esteban Borja Lopez May 12, 2022

Hello community, 

I have a simple automation rule that set OLA/SLA target times based on creation date-time of a given ticket.

As I want to setup different timezones depending on the project/customer location (so timer is set on local time), and understanding that ticket creator personal settings are being taken to define the timezone, I want to make sure that the times are always converted to the expected timezone for that given project (e.g. Europe/Madrid).

To do so, im using the following expression to edit a custom field:

  • {{issue.Created.convertToTimeZone("Europe/Madrid").plusMinutes(15)}}

The expectation is that irrespective of the timezone setting of the ticket creator (even if not defined, it will take default system value), the creation date is always converted to the timezone I define, but this is not working properly. Here some real examples:

  • This rule takes the creation date and convert it to Bolivia time (using canonical id as indicated in documentation), and add the defined time (15mins and 4hours for Response Time and Resolution Time respectively):
    • Rule Config:
      • Screenshot 2022-05-12 at 11.40.59.png
    • Creation date timestamp for a random ticket chosen:
      • Screenshot 2022-05-12 at 11.50.42.png
  • The expected results for automation are:
    • OLA Response Time Target = May 12, 2022, 5:32 AM ----> Bolivia timezone (-6 hours from my time) + 15 mins

    • OLA Resolution Time Target: May 12, 2022, 9:17 AM ----> Bolivia timezone (-6 hours from my time) + 4 hours

  • Actual results are:
    • OLA Response Time Target = May 12, 2022, 11:32 AM ----> Madrid timezone (the same timezone defined on my profile) + 15 mins

    • OLA Resolution Time Target: May 12, 2022, 3:17 PM ----> Madrid timezone (the same timezone defined on my profile) + 4 hours.

      • Screenshot 2022-05-12 at 11.50.29.png

Tried changing convertToTimeZone to SetTimeZone expressions among many other combinations, but always get unexpected results. Not sure if al this is correcto and this is because of the viewer will always see the datetime on local time; if Im doing something wrong; there is a config that overwrites/mess-up my calculations... or it this post does make any sense at all :)

This is a key setup I need as I have multiple projects and countries all over the world so want to make sure the timezone are always correct, irrespective of creator or system config.... Any hint?

Thanks in advance, 

Esteban

1 answer

0 votes
Bill Sheboy
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.
May 17, 2022

Hi @Esteban Borja Lopez 

My understanding of the time zones, in regards to automation rules, is that they impact: 

  • date/time math when operating on different fields/smart values, such as with the diff() function
  • and presentation of results as text, such as in a comment or email

For each individual user, I would expect presentation of date/times to match their profile.

Are you wanting all users to see the same time zone values, regardless of their physical location and profile settings?

Kind regards,
Bill

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events