Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Apps - Building 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,

  • Parnicaboda Profile Picture
    2 on at
    Re: Convert date to number

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

  • NAVEEN1 Profile Picture
    9 on at
    Re: Convert date to number

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

  • cederbusch Profile Picture
    16 on at
    Re: Convert date to number

    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");"-";"")
  • Lewkir Profile Picture
    on at
    Re: Convert date to number

    Yep this worked.

     

    Thanks.

  • Verified answer
    R3dKap Profile Picture
    1,594 on at
    Re: Convert date to number

    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

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

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Markus Franz – Community Spotlight

We are honored to recognize Markus Franz as our April 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,618 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 65,957 Most Valuable Professional

Leaderboard