web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / CONVERT DATE ISO 8601
Power Apps
Unanswered

CONVERT DATE ISO 8601

(0) ShareShare
ReportReport
Posted on by

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!

Categories:
  • Pstork1 Profile Picture
    69,661 Most Valuable Professional on at

    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)

     

  • mdevaney Profile Picture
    29,993 Moderator on at

    @Gorilla_8 

    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." 

  • mdevaney Profile Picture
    29,993 Moderator on at

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

  • Gorilla_8 Profile Picture
    on at

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

     

    I need help with this...

  • mdevaney Profile Picture
    29,993 Moderator on at

    @Gorilla_8 

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

  • Gorilla_8 Profile Picture
    on at

    @Pstork1 

     

    Where?

  • Pstork1 Profile Picture
    69,661 Most Valuable Professional on at

    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.

  • Gorilla_8 Profile Picture
    on at

    @Pstork1 Thanks for the reply!

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

     

    Sorry about that 😞

  • Pstork1 Profile Picture
    69,661 Most Valuable Professional on at

    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)

     

  • Gorilla_8 Profile Picture
    on at

    Thanks for the reply @Pstork1 !

     

    Here some my code: 

     

    toggle_porcentagem.Value = true;
     Filter(
     AddColumns(
     collTaskListForGallery;
     "DateColumn";
     DateAdd(
     DateTimeValue("1970-01-01 00:00:00");
     Value(
     Mid(
     DatadeIníciodaTarefa;
     7;
     13
     )
     );
     Milliseconds
     )
     );
     If(
     drpFilter.Selected.Value = "Data início";
     Text(
     DateColumn;
     DateTimeFormat.ShortDate
     ) = Text(
     DatePicker1.SelectedDate;
     DateTimeFormat.ShortDate
     )
     )
     )

     

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 381 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 340

#3
WarrenBelz Profile Picture

WarrenBelz 187 Most Valuable Professional

Last 30 days Overall leaderboard