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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / converting UTC string ...
Power Apps
Unanswered

converting UTC string to Date only

(0) ShareShare
ReportReport
Posted on by 270

hi all,

 

I have a Collection storing UTC date in a field.

 

UpdateIf(ccTasks,ID=ThisItem.ID,{ReadyTime:Text(Now(),DateTimeFormat.UTC)})

 

the stored data in the collection comes through as:

2021-04-18T22:35:45.665Z

 

i'm trying to just extract the date via:

Text(DateTimeValue(ThisItem.AircraftReady, "en-US"), "[$-en-GB]dd-mm-yyyy")

 

but the date reads as "19-04-2021" ...but the collection i should see "18-04-2021"

 

i'm guessing it's something to do with the "en-US" or [$-en-GB] but i can't figure it out to make it work and display how i want.

 

can someone assist please. 

Categories:
I have the same question (0)
  • WarrenBelz Profile Picture
    153,034 Most Valuable Professional on at

    HI @mrleetyler ,
    The problem is that you are behind UTC, for some of the day (I have the opposite issue being 10 hours ahead). You need the TimeZoneOffset function which returns the difference between the user and UTC. You just add this to UTC.

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

  • mrleetyler Profile Picture
    270 on at

    but if the collection is already
    2021-04-18T22:35:45.665Z

     

    why can't PA just pull the date like it can the time? why does it change it to todays date. 😞

  • Verified answer
    WarrenBelz Profile Picture
    153,034 Most Valuable Professional on at

    HI @mrleetyler ,

    Just did some experimenting here - using the collection value

    ClearCollect(
     colUTC,
     {
     UTCVal:
     Text(
     Now(),
     DateTimeFormat.UTC
     )
     }
    )

    gets one record exactly like yours (showing UTC time which is 10 hours behind) - then I put another label with this

    WarrenBelz_0-1618804355010.png

    and got the correct time here - I do not need TimeZoneOffset - it just worked it out - you might see where yours is different.

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

  • mrleetyler Profile Picture
    270 on at

    thanks @WarrenBelz  

     

    i tried this on an isolated environment and it worked fine, if i did now()-1 it changed the date as we'd expect.

     

    will play around with it in my live envrionment to get it working as above 🙂 

     

    thanks again

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 717 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 329 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard