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?
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 ")
Finnaly i'm able to using this smart value and save to date time field
.ToDate("dd/MM/yyyy HH:mm:ss")
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Good to know that this worked for you
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Mike Saldivar I had to experiment a bit aswell before understanding the concept: toDate() needs the expression of your INPUT to work ("how the string in customfield_007 is structured"). Following this conversion the expression you use in format() specifies the OUTPUT. In your case: Switch expressions from toDate and format like this:
{{issue.customfield_007.toDate("d/m/yy").format("yyyy-MM-dd")}}Kind regards and smooth sailing!
EDIT: That aside, if you want to parse to a field with Date or DateTime format, you do NOT need the .fromat() step. It is enough to parse {{issue.customfield_007.toDate("d/m/yy")}} to the correct field through the "Edit field" action in your automation.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.