Forums

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

How to format a created variable in automation to date?

Marc Schadee
Contributor
December 1, 2023

Hi,

 

I am trying to use datediff capabilities with a created variable that pulls a date from a comment.

This is the text that creates the variable "BlockedDate"

{{issue.comments.first.body.substringBetween("Blocked : ","States :")}}

It parses a comment and pulls the date (but i assume is formatted as a string)

This is effectively what it is parsing

Blocked : Dec 1, 2023, 11:40:47 PM
States :

and it will print "Dec 1, 2023, 11:40:47 PM" to a comment

When I print this in a comment though I get no fail message but nothing printed
{{now.diff(BlockedDate.toDate).hours}}

Any suggestions/help would be appreciated

Marc

Capture.PNG

1 answer

1 accepted

4 votes
Answer accepted
Marc Schadee
Contributor
December 1, 2023

{{BlockedDate.toDate("MMM dd, yyyy, hh:mm:ss a")}} is what resolved my issue

Suggest an answer

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

Atlassian Community Events