Confiform: Formatting dates pulled from Jira
Asked by Erin Smith:

I have a Confiform in Confluence that is populating fields based on information in a Jira ticket based on the Key the user fills in.

One of the fields is pulling in the Created Date which in Jira has the format dd/MMM/' 'yy HH:mm PM

We only want the date portion, but no matter how I use the "formatDate" function, or the "convertDate" function it won't pull the information into Confluence.

If I don't format it, I just put fields.created it populates the field in the form as: yyyy-MM-ddT16:28:02.860-0500

If I do try to format it, it leaves the field blank.

Any ideas on what I'm doing wrong or how I can pull just the date portion of the information from Jira?


Answers:
author: Alex Medved _ConfiForms_
body: Hi

Yes, there is a bit of a confusion ConfiForms is having and you need to help it with a parseDate function and Jira format for date/time field

```
fields.created.parseDate(yyyy-MM-dd'T'HH:mm:ss.SSSZ)
```

Then you can either format it or extract a timestamp

```
fields.created.parseDate(yyyy-MM-dd'T'HH:mm:ss.SSSZ).formatDate(yyyy-MM-dd)
fields.created.parseDate(yyyy-MM-dd'T'HH:mm:ss.SSSZ).timestamp
```

Hope it helps

Alex

comments: author: Erin Smith
body: You Sir are a God.

Thank you so much, this is now working flawlessly.


author: Info Developer
body: Thanks Alex.

As you advised, I entered the parsed and formatted date below into the Field Name (see the first attached image):

myissue.fields.created.parseDate(yyyy-MM-dd'T'HH:mm:ss.SSSZ).formatDate(yyyy-MM-dd)

But, the date is still not formatted. See the second attached image. I don't know what I have done wrong

![Date Value entered into Field name.jpeg](https://community.atlassian.com/t5/image/serverpage/image-id/246762i4441D647BD8C88EC/image-size/large?v=v2&px=999 "Date Value entered into Field name.jpeg")![Table View Output .jpeg](https://community.atlassian.com/t5/image/serverpage/image-id/246763i0F31D09DF43463B0/image-size/large?v=v2&px=999 "Table View Output .jpeg")

comments: author: Alex Medved _ConfiForms_
body: I see a different (and an expected) result

![Screenshot 2023-03-21 at 15.42.20.png](https://community.atlassian.com/t5/image/serverpage/image-id/246774iD3B65DA32D148AF0/image-size/large?v=v2&px=999 "Screenshot 2023-03-21 at 15.42.20.png")

Hard to "debug" your configuration by looking at these photos...

But did a quick test, following the advise given to Erin earlier and that works just as mentuined

In my screenshot the second column is a field with field name set to

```
myissue.fields.created
```

And the 3rd column is the field with field name set to

```
myissue.fields.created.parseDate(yyyy-MM-dd'T'HH:mm:ss.SSSZ).formatDate(yyyy-MM-dd)
```

myissue is the name of the field (Jira issue type) in my form

Alex


author: Info Developer
body: Thanks for your prompt response, Alex.

I will try this again when my Confluence comes up, and get back to you


author: Info Developer
body: Hi Alex,

I noticed my mistake: Instead of single colon, I entered double colon between "ss" and "SSSZ". (ss:SSZ)

I changed it to single colon (ss.SSZ), and it is working now

Thanks so much!


author: Info Developer
body: Please, how do I format the Created Date (mentioned by [Erin Smith](https://community.atlassian.com/t5/user/viewprofilepage/user-id/727708)) in "ConfiForms Form Field" Macro?

In the Macro, I entered myissue.fields.created.parseDate(yyyy-MM-dd'T'HH:mm:ss.SSSZ) as the field name, and yyyy-MM-dd inside the Override output format text box.

But, the format is not changing to yyyy-MM-dd.

Kindly assist

comments: author: Alex Medved _ConfiForms_
body: Hi

You do it by parsing and formatting the date as explained in my earlier comment to Erin

```
myissue.fields.created.parseDate(yyyy-MM-dd'T'HH:mm:ss.SSSZ).formatDate(yyyy-MM-dd)
```

Alex


Tags: confiforms

confluence-server

jira

server