Forums

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

Parsing text to date format

Duc Thang TRAN
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 Champions.
February 12, 2025

Hello Every one , 

I'm looking for a solution to convert a text field into a date-time format.

For example, I have a Text 3 field with a value like: 12/02/2025 13:51:21.

I need a smart value that can save this value into a date-time field. The default format on my instance is dd/MMM/yyyy h:mm a.

I'm using .toDate, but it’s not working until I change my text field value to 12/Feb/2025. Do you know a way to convert a text field when its format differs from the instance's default date format?

1 answer

1 accepted

4 votes
Answer accepted
Vishal Biyani
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 Champions.
February 12, 2025

@Duc Thang TRAN 

with toDate you need to specify the format. Are you doing that?

Once string is converted to date, use .format to update the date format

.toDate("yyyy-MM-dd").format("MM/dd/yyyy H:m:s ")

Duc Thang TRAN
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 Champions.
February 12, 2025

@Vishal Biyani 

Finnaly i'm able to using this smart value and save to date time field 

.ToDate("dd/MM/yyyy HH:mm:ss")

 

Vishal Biyani
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 Champions.
February 12, 2025

Good to know that this worked for you

Mike Saldivar
December 11, 2025

I have the same question, can you explain the answer?

I have a webhook that's pulling in a date in the format like 4/5/25 for April 5, 2025.

How do I turn that into a Jira yyyy/mm/dd format for the Due Date?

In my Jira automation for the Due date I have:

{{issue.customfield_007.toDate("yyyy-MM-dd").format("d/m/yy")}}

Is the toDate("yyyy-MM-dd") what gets passed to the Due Date?

and format("d/m/yy") what it's pulling from the custom field with the field with a date 4/5/25?

Suggest an answer

Log in or Sign up to answer