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 / Sort not working prope...
Power Apps
Unanswered

Sort not working property with DateTimeValue

(0) ShareShare
ReportReport
Posted on by 195

Hi Everyone

Good day! 

I would like to ask for your help how to solve this issue. I use Sort Filter function. The date is sorting correctly but the time, AM and PM was not sorting properly. 

 

 

DateTimeValue(NewIncidentDate) >= DatePicker_StartDate.SelectedDate && 
DateTimeValue(NewIncidentDate) <= DatePicker_EndDate.SelectedDate

 

 

The output is: 

YamiteKudasai_0-1661493267894.png

 

I found also if you add "0" or 0 example on time like 3:28 to 03:28 the time sorts properly. But how to achieve this?

 

It should  have time  7/1/2022 1:45 AM, 7/1/2022 2:00 AM, 7/1/2022 3:28 AM, 7/1/2022 10:00 should be the proper order.

 

 

Thanks in advance for your help.

Categories:
I have the same question (0)
  • theapurva Profile Picture
    970 Super User 2024 Season 1 on at

    Hello @YamiteKudasai :
    I tried to replicate on my site but sorting is working correctly for the Date Column.
    Can you please verify once if your Column is of type 'Date time' only?

  • YamiteKudasai Profile Picture
    195 on at

    Hi @theapurva , 

    Good day! 

    The picker is just in date. But the value in NewIncidentDate is in format 07/1/2022 10:00 AM something like this. So any solutions I can sort the result based on date and time?

     

  • theapurva Profile Picture
    970 Super User 2024 Season 1 on at

    Hello,
    Could you please con, firm what is your database? Is it SharePoint?
    If it is SharePoint, NewIncidentDate column should be of type Date and time then only it will work.

    theapurva_0-1661516864724.png

     

    You can change the Column type to Date and Time but you may lose the timing and may need to manually fill it for the first time after you change the column type.

    Also, make sure to select the 'Date and Time' format setting like above screenshot while changing the column type.

  • YamiteKudasai Profile Picture
    195 on at

    The datasource is sql

  • theapurva Profile Picture
    970 Super User 2024 Season 1 on at

    Hello @YamiteKudasai ,
    Understood.
    Please convert your column to datetime in Items formula as below:

    Sort(Filter(YourTableName,yourfilters),Text( DateTimeValue( NewIncidentDate ), "dddd, mmmm dd, yyyy hh:mm:ss.fff AM/PM" ), Ascending)

     this>  Text( DateTimeValue( NewIncidentDate ), "dddd, mmmm dd, yyyy hh:mm:ss.fff AM/PM" ) will correctly sort the data as it is converting it to DateTime value

  • theapurva Profile Picture
    970 Super User 2024 Season 1 on at

    Hello @YamiteKudasai 

    Did that formula work for you?

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Apps

#1
wolenberg_ Profile Picture

wolenberg_ 119 Super User 2026 Season 1

#2
WarrenBelz Profile Picture

WarrenBelz 107 Most Valuable Professional

#3
Haque Profile Picture

Haque 103

Last 30 days Overall leaderboard