cancel
Showing results for
Did you mean:
Post Prodigy

## CONVERT DATE ISO 8601

Hey guys, I need to filter a gallery by date, but on the collection, the date comes like this:

``1582097400000 ``

There is a possibility to convert and make a filter my gallery by date? And I need to make a default filter date + 7 days forward.

The name of the column:  DatadeIníciodaTarefa

Thanks for the help guys!

15 REPLIES 15
Dual Super User III

I believe what you have is the number expressed in Ticks.  Ticks in this case being the number of seconds after midnight on 01/01/1970.  So you can use the following formula to convert a regular date field to a similar number and use that for sorting

``DateDiff(DateTimeValue("01/01/1970 00:00:00"), DateFieldToConvert, Seconds)``

Or you can convert the Ticks back to a date using this formula

``DateAdd(DateTimeValue("01/01/1970 00:00:00"),NumberOfTicks,Seconds)``

-------------------------------------------------------------------------
If you like my response, please give it a Thumbs Up.
Super User III

Please provide instructions for how to convert this number into a date.

``1582097400000``

Also let the forum know what date this number translates to?

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

Super User III

Well... at least @Pstork1 understands what that crazy number means 😁

Post Prodigy

@mdevaney I don't have a clue about how to convert this number to a date 😞

I need help with this...

Super User III

...did you try the suggestion of @Pstork1?

Post Prodigy

Where?

Dual Super User III

First, since the number is measured in Ticks, the number of seconds after midnight on 01/01/1970. you can just sort based on that numeric field. Larger numbers are later and smaller numbers are earlier.

For the range calculation. Add or subtract the number of seconds in the time period you want to use.  7 days would be 7 * 24 hours * 60 minutes * 60 seconds.  That comes to 604,800 seconds.

to convert back into a date use the formula I provided in my previous reply.

-------------------------------------------------------------------------
If you like my response, please give it a Thumbs Up.
Post Prodigy

But unfortunately, I can't find the reply post you are mentioning...

Dual Super User III

It was the first reply on this post.

I believe what you have is the number expressed in Ticks.  Ticks in this case being the number of seconds after midnight on 01/01/1970.  So you can use the following formula to convert a regular date field to a similar number and use that for sorting

``DateDiff(DateTimeValue("01/01/1970 00:00:00"), DateFieldToConvert, Seconds)``

Or you can convert the Ticks back to a date using this formula

``DateAdd(DateTimeValue("01/01/1970 00:00:00"),NumberOfTicks,Seconds)``

-------------------------------------------------------------------------
If you like my response, please give it a Thumbs Up.

Announcements