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 / Convert date to number
Power Apps
Unanswered

Convert date to number

(0) ShareShare
ReportReport
Posted on by

So I am trying to make a unique ID out of a date and need to conviert it to a number ideally in the format yyymmdd.

 

I can get the date picker to display this way but when I try to put it in a label it converts it back to dd/mm/yyyy.

 

When I try:

Text(FromDate,"yyyymmdd") 

Powerapps still displays it dd/mm/yyyy and converts the code to:

Text(FromDate,"[$-en-US]yyyymmdd") 

Not sure why this is happening.

 

Can anyone help me out?

 

Cheers,

Categories:
I have the same question (0)
  • Verified answer
    R3dKap Profile Picture
    1,594 on at

    Hi @Lewkir,

    That's normal behavior from PowerApps. When using the Text() function, if you specify a format (like "yyyymmdd"), PowerApps will automatically add the "[$-en-US]" prefix to your format to tell the system what locale format to use. But in the end, you get the same result.

    If you set the Default property of a text input control to Text(FromDate,"[$-en-US]yyyymmdd"), it will show your date with that format. You can then convert it to a integer using the Value() function.

    Hope this helped,

    Emmanuel

  • Lewkir Profile Picture
    on at

    Yep this worked.

     

    Thanks.

  • cederbusch Profile Picture
    16 on at

    I can´t get this to work. Followed per instruction, still shows "yyyy-mm-dd". 

    Eventually used Substitute to remove all the "-".

    Substitute(Text(FromDateDatePicker;"[$-us-US]yyyymmdd");"-";"")
  • NAVEEN1 Profile Picture
    9 on at

    thank u cederbusch 🙂 it worked for me but i used   Substitute(Text(DATE),"/","")

  • Parnicaboda Profile Picture
    2 on at

    can we do this on textbox or have to do on datepicker's default date?

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