JIRA Rest API: Question about date formatting

Hello fellow developers,

I’m trying to get all comments on all issues within a project using this url:
/rest/api/2/search?jql=project%20%3D%20${project.key}&expand=renderedFields&fields=id,comment

The comment created and updated dates are formatted like this “Today 9:09 PM”. This is super unhelpful when trying to convert to a python datetime. Is there something I can add to the url to get date fields in ISO format? Like a expand=dates option or something? (Asking our clients to configure their sites to use absolute datetimes is not an option). Also I’m using v2 in order to get the html content of the comment. v3 currently does not support this.

Any help would be appreciated,
Thanks!

Hello @ThomasGriffiths

In the response, the renderedFields object contains the dates as rendered to the user, in HTML, on the web page:

“created”: “01/Sep/21 4:43 PM”

The response should also contain the matching fields object, which will contain the dates in the underlying UTC encoded format you’re looking for:

“created”: “2021-09-01T16:43:14.492+1000”

1 Like

Oh I see! I didn’t realize renderedFields would change the date fields. Turns out the response includes both a fields and a renderedFields property. The raw dates can be found in the fields property. So I had access to the ISO dates all along :sweat_smile:. Thanks so much for your help!