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 to number
Power Apps
Answered

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");"-";"")
    Skärmklipp.JPG
  • 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

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Valantis Profile Picture

Valantis 483

#2
WarrenBelz Profile Picture

WarrenBelz 399 Most Valuable Professional

#3
11manish Profile Picture

11manish 327

Last 30 days Overall leaderboard