Forums

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

Date format smart value.

PhilSpo
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 Leaders.
October 16, 2020

Hello,

Using Automation for Jira I am simply adding some comments to the ticket using SmartValues.

 

The field in question is 'Target start' (custom field from advanced roadmaps)

 

The field itself displays on the issues as:

 image.png

However when I put it into the automation: 

 

'This work has been scheduled to commence on {{Target start}}'

It comes out as:

 

image.png

 

Any idea how i can change the format into DD-MM-YYYY ?

 

Many Thanks

 

Phil

 

 

 

 

2 answers

1 vote
John Funk
Community Champion
October 16, 2020

Hi @PhilSpo ,

I use this:  {{issue.customfield_16705.longDate}} 

But it can also be written:

{{issue.Target start.longDate}}

That will give you a result of October 17, 2020.

PhilSpo
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 Leaders.
October 19, 2020

Hello John,

 

Cheers for the suggestion.

 

I have the automation setup as follows:

image.png

 

But if I use that format or {{issue.customfield_xxxxx.longDate}}  it keeps coming out as :

 

image.png

 

It just ignores the Target start field completely, unless I add it in as {{Target start}} which then displays as 2020-10-17

 

Im stumped!!

 

Cheers

 

Phil

John Funk
Community Champion
October 19, 2020

Hey @Simmo  - Can you shed some light on this? Is this just a weird field type? 

John Funk
Community Champion
October 22, 2020

@PhilSpo  also looks like there is this format: 

{{issue.resolutiondate.asLongDateTime}}

You might drive the as in front of LongDate.

Also see Andreas's suggestion below. 

John Funk
Community Champion
October 23, 2020

Hey @PhilSpo  - try this one:

{{issue.Target start.toDate.shortDate.format("dd/mm/yy")}}

PhilSpo
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 Leaders.
October 26, 2020

Hey @John Funk 

 

Unfortunately this hasn't worked either. It just returns no data.

 

Seems that this field isnt a date picker, but you can convert it to a date but not change the format.

Thanks for your suggestions in trying to help with this. Its much appreciated.

 

Cheers

 

Phil

Like John Funk likes this
0 votes
Jack Brickey
Community Champion
October 16, 2020

Have a look at this documentation - smart-values-date-and-time-functions . Focus on the 

{{[date].[dateformat]}}

PhilSpo
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 Leaders.
October 16, 2020

Hello @Jack Brickey 

I did take a look at this page before I posted, it seems everything I try doesn't bring back any values at all.

 

Cheers

 

Phil

PhilSpo
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 Leaders.
October 16, 2020

I think the problem is going to be that the field is not a 'Date Picker' type of field.

 

image.png

Jack Brickey
Community Champion
October 16, 2020

I have not played with it myself. I did find this thread that seems to indicate the need of the “#” - Format-Custom-Field-Date 

Jack Brickey
Community Champion
October 16, 2020

Hmmm, could be. But it is a date field.

Andreas Knecht
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
October 20, 2020

Hi Jack,

If this is not a date field, but looks like a date field, then you'll have to parse it into a date first.  You can do this with our `toDate` function. See "Converting text to dates" on https://confluence.atlassian.com/automation/working-with-dates-993924630.html

 

Something like {{issue.Target start.toDate.shortDate}} should work!

Cheers,
Andreas

PhilSpo
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 Leaders.
October 23, 2020

Hi Guys,

 

Thanks you for your responses in trying to help overcome this situation.

 

@John Funk  i tried using the 'asLongDateTime' but unfortunately it returns no values and is blank.

 

@Andreas Knecht  First of all I tried {{issue.Target start.toDate.shortDate}} but this returned 10/23/20

 

So then i combined that with the suggestion of John and used {{issue.Target start.toDate.longDate}}

 

This came back with October 23, 2020

 

This is a bit better for UK customers to understand but I'm still looking for that elusive dd/mm/yy format.

 

Using any of the below combinations produces no values.

{{issue.Target start.toDate("yyyy MM dd")}}

{{issue.Target start.toDate("dd MM yyyy")}}

{{issue.Target start.toDate("dd MM yy")}}

Cheers

 

Phil

Like Peter Quick likes this
Casey Gould
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 Leaders.
May 1, 2023

I think these last ones are close but failing without the slashes.

If {{issue.Target start.toDate.shortDate}} successfully produces a date, the formatting piece for day-month-year would be: 

{{issue.Target start.toDate.format("dd/MM/yy")}}

Suggest an answer

Log in or Sign up to answer