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 edited

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
atlassian, atlassian government cloud, fedramp, webinar, register for webinar, atlassian cloud webinar, fedramp moderate offering, work faster with cloud

Unlocking the future with Atlassian Government Cloud ☁️

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 Now
AUG Leaders

Atlassian Community Events