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 / Date format issue resu...
Power Apps
Answered

Date format issue resulting into weird output

(0) ShareShare
ReportReport
Posted on by 147

Good day all,

 

For a datepicker, I want to force a certain format and turn it into a text, using the following code:

 

Collect(
 Collection,
 {
 Date: Text(DateTimeValue(I_Date, "en"), "m/d/yyyy", "en")
 }
);

 

Now for most, including me, this works perfectly. I enter a date on the left and on the right appears the date in a gallery, displaying the collection.

 

However, one of my users struggles when entering dates with double digit months. For example, when she selects the date October 21st 2023, which shows in the date picker as '10/21/2023' (as it should), but then the date pops up in the gallery as '09/10/2024'. 

 

I have tried changing the format to 'mm/dd/yyyy', but the app keeps behaving the same for her.

 

Does anyone know how to overcome this issue? It's a really tough one for me to solve, as I am unable to replicate it myself and therefore can't test through trial and error easily.

Categories:
I have the same question (0)
  • Verified answer
    timl Profile Picture
    36,749 Super User 2026 Season 1 on at

    Hi @Daniël 

    This formula should return the correct value.

    Collect(
     Collection,
     {
     Date: Text(I_Date.SelectedDate, "m/d/yyyy", "en-US")
     }
    );

     

    If you're using a Date Picker control, the SelectedDate property will return the Date without you needing to parse it with DateTimeValue. The problem with your formula is that you're assuming the end user device is configured with a locale that uses date formats in month/day/year format.

     

    I'm in the UK and this type of formula will not work for me as you can see below (it generates the 10/09/2024 value). Therefore, it's important to specify "en-US" as the locale since this uses the m/d/y format.

     

    timl_0-1699453570034.png

     

     

  • Daniël Profile Picture
    147 on at

    Hi @timl,

     

    Thank you so much for your reply. We're already moving into the right direction. The only issue is that I now struggle with something else:

    My user has inserted the date in the date-picker, only this time the output is '21-10-2023'. This is the correct date, but it is essential that it says '10/21/2023', as a specific format is required. I am not sure why it would convert back to the Dutch formatting, despite mentioning a US-format.

     

    I am starting to wonder what formatting indications like "m/d/yyyy" and "en-US" are even doing at this point...

     

    I tried combining our two codes as follows:

    Collect(
     Collection,
     {
     Date: Text(DateTimeValue(I_Date, "en-US"), "m/d/yyyy", "en-US")
     }
    );

     

    But then again, same issue as before. Do you know how to get it back into format?

  • timl Profile Picture
    36,749 Super User 2026 Season 1 on at

    @Daniël 

    If the requirement is to show the date in m/d/yyyy format in the date picker, the answer is to set the date format property in the date picker.

    timl_0-1699458628869.png

     

    As I mentioned in my earlier post, I would strongly advise that you reference the SelectedDate property of the date picker control rather than call DateTimeValue.

     

     

  • Daniël Profile Picture
    147 on at

    You're helping me so kindly and I repay you by not even reading correctly. I have indeed used the .SelectedDate extension this time and tested it with my user this morning. This has solved the issue. Thank you!

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 525 Most Valuable Professional

#2
Haque Profile Picture

Haque 273

#3
Kalathiya Profile Picture

Kalathiya 232 Super User 2026 Season 1

Last 30 days Overall leaderboard