Time stamp translation to date

Hi all,
I’m trying to get tasks finished by a team de last week. I’m using the API and the task field completed_at, task[‘completed_at’]. This field returns me the time in a time stamp format: 2020-03-17T14:38:49.239Z. It’s possible to get this in a date format (like “2020-03-17”) or an easy way to translate it?

Thank you!

Hi @Gabriel_Barcelo

That date format is the ISO-8601, the most easy to convert to a date object in your code.
The “Z” at the end indicates that that date is in UTC.

So, exemple in javascript, you can use
var d = new Date(“03-17T14:38:49.239Z”);
And you will always get the good value when reading it in the timezone of your browser, it will be converted from UTC to your timezone.
That date is absolute, timezone and daylight independent.
Also works directly, in .NET, PHP, …
That date format is the best one to use in API.

1 Like

I suggest using librairies like moment or date fns to deal with dates.