Let's say i have a timestamp data like "2024-02-05T09:32:10.4+0000"
I create a variable in automation for example;
Variable name = timestamp
Access your variable in other actions by using {{timestamp}}
Smart Value = 2024-02-05T09:32:10.4+0000
When i edited a custom field named "AAA" (Date Picker) by referencing the smart value like "{{timestamp.format("yyyy-MM-dd")}}
The result is shown as Feb 05, 2024
But when i edited a custom field named "BBB" (Date Time Picker) by referencing the smart value like "{{timestamp.format("yyyy-MM-dd")}}
The result is instead shown as Feb 05, 2024, 7:00 AM
I am wondering why the "BBB" date time picker custom field displayed as
Feb 05, 2024, 7:00 AM, while i expected that it should have shown as "
Feb 05, 2024, 9:32 AM"
May i ask what is the correct smart value format that support the date time picker custom field?
Hi @Boyd Hong
Variables are stored as text. To later use that as a date or date / time, it must be converted using the toDate function. https://support.atlassian.com/cloud-automation/docs/examples-of-using-smart-values-with-dates/#Converting-text-to-dates
The format() function formats a field as text, not to a date / time displayed in a particular format. https://support.atlassian.com/cloud-automation/docs/jira-smart-values-date-and-time/#Date-format---
Next, without any formatting / conversion, the display of dates and date / times is based on your site and profile settings.
And so you appear to be comparing the display of pre-formatted text (the variable) with a date / time field displayed with your profile settings. Please adjust accordingly to align to the values you need.
Kind regards,
Bill
Hi,
there is a list for {{[date].[dateformat]}} here:
https://support.atlassian.com/cloud-automation/docs/jira-smart-values-date-and-time/
And:
The format is given by the field here. DatePicker uses the [jiraDate] format, so it will give you only the date. In case of your BBB-Field it is (probably?!) using the [mediumDateTime] format. So 7:00 might be the default value, if not given. And since it can not access in your format it will just use that.
Workaround to try:
Display your value in a Custom-TEXT-Field- This way you can just use the format given by the Smart-Value-[DateFormat] you can choose from the list above. You could also check your System > General Configuration > "Advanced Settings" to set the global format.
Hope this information is helpful.
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.