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 / find the most recent t...
Power Apps
Answered

find the most recent timestamp

(0) ShareShare
ReportReport
Posted on by 24

Hello Team,

 

I have a column in SQL table called timestamp as string in the format like 05/19/2020 08:47:10

 

I have a similar column in collection with same exact format. I want to compare both these time stamps to find out which one is most recent. Can someone please help?

 

Thanks.

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

    Hi @vshah2 

    You will need to use the DateTimeValue() function to convert your date and time.  Check the documentation to see how to do it. https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-datevalue-timevalue 

    You would use DateDiff(DateTime1,Today(),Minutes) and DateDiff(DateTime2,Today(),Minutes) to compare the two values.

  • Verified answer
    v-xida-msft Profile Picture
    Microsoft Employee on at

    Hi @vshah2 ,

    How do you want to compare the timestamp between your SQL Table and your collection?

    Do you want to find the latest timestamp between your SQL Table and your collection?

     

    I agree with @Drrickryp 's thought almost, there is no direct way to compare the timestamp string value between the SQL Table and collection. You need to convert the timestamp string value into a actual date time value, and then you could compare the converted date time value.

     

    In order to find the latest timestamp value in SQL Table, please try the following formula (set Text property of a Label to following):

    First(
     SoftByColumns(
     AddColumns('[dbo].[SQLTable]', "Timestamp_DatetTime", DateTimeValue(timestamp)),
     "Timestamp_DatetTime",
     SortOrder.Descending
     )
    ).timestamp

     

    In order to find the latest timestamp value in your collection, please try the following formula:

    First(
     SoftByColumns(
     AddColumns(CollectionTable, "Timestamp_DatetTime", DateTimeValue(timestamp)),
     "Timestamp_DatetTime",
     SortOrder.Descending
     )
    ).timestamp

     

    If you want to compare the latest timestamp value in your SQL Table and your collection table, please try the following formula (set the Text property of a Label to following):

    If(
     First(
     SoftByColumns(
     AddColumns('[dbo].[SQLTable]', "Timestamp_DatetTime", DateTimeValue(timestamp)),
     "Timestamp_DatetTime",
     SortOrder.Descending
     )
     ).Timestamp_DatetTime >
     First(
     SoftByColumns(
     AddColumns(CollectionTable, "Timestamp_DatetTime", DateTimeValue(timestamp)),
     "Timestamp_DatetTime",
     SortOrder.Descending
     )
     ).Timestamp_DatetTime,
     "The Lastest Timestamp value is in SQL Table",
     "The Lastest Timestamp value is in Colelction"
    )

     

    Best regards,

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

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 345 Most Valuable Professional

#2
11manish Profile Picture

11manish 207 Super User 2026 Season 2

#3
Mohsin Ali Profile Picture

Mohsin Ali 177

Last 30 days Overall leaderboard