I'm trying to write an automation that parses a string with a date like
'd/m/yy, h:mmam/pm'
e.g. 5-1-23, 8:00am
Is this possible with Jira automation and the smart values and functions available?
Thanks!
Hi @James Duffy
Yes, and you can use the toDate conversion on the field, such as:
{{issue.myField.toDate}}
Try using the jiraDateTime or jqlDateTime formats, as defined in the documentation. When needed, also convert to your time zone to enforce the desired value.
Kind regards,
Bill
Hi Bill,
I've tried this and it looks like it only converts the string to a date, without a time. For reference, an example date I am using is 2023-06-15T01:00:30.902Z, and when I use .toDate, it returns 2023-06-22T00:00:00.0+0000
Is there something wrong with my initial string?
Thank you,
Jennifer
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Nevermind, I needed to convert from 2023-06-15T01:00:30.902Z to 2023-06-15T01:00:30.902+0000, and then it worked with no issues.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi, I'm facing the same issue now with .toDate ignoring time. How did you convert 2023-06-15T01:00:30.902Z to 2023-06-15T01:00:30.902+0000? Did you do this inside the automation rule?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
i stored the value in a variable, e.g. time = 2023-06-15T01:00:30.902Z
then did the following:
{{time.replace("Z","+0000").toDate}}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
an alternative is to also just do variable time = 2023-06-15T01:00:30.902Z
then:
{{time.toDate("YYYY-MM-dd'T'hh:mm:ss.SSS'Z'")}} or whatever format your time string is currently
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Atlassian Government Cloud has achieved FedRAMP Authorization at the Moderate level! Join our webinar to learn how you can accelerate mission success and move work forward faster in cloud, all while ensuring your critical data is secure.
Register NowOnline forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.