cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
EdwinChua
Frequent Visitor

Date formatting - Incorrect Locale

I have a form field, which is autopopulated by the variable 'd1', which is initialized this way:

 

Set(d1,Text( Today(), "[$-en-US]dd mmm yyyy"));

 

 

In most cases, this works nicely, and when the form is submitted (a sharepoint list item is created), I get "28 May 2020" in the date column.

 

However, I noticed that some users set their locale (or something), which messes with this, and instead I end up with "02 6月 2020".  This field is not visible to the user.

 

Questions:

1. Is this the expected behaviour of the Text() function?

  • I had expected that specifying [$-en-US] would have standardized the formatting.

2. Is there anyway to ensure I get the date like this ("28 May 2020") regardless of the user's locale settings?

1 ACCEPTED SOLUTION

Accepted Solutions
timl
Super User III
Super User III

Hi @EdwinChua 

This should produce the correct output for you.

Set(d1,Text( Today(), "[$-en-US]dd mmm yyyy", "en-US"));

 

The third argument defines the output locale.

The [$-en-US]  part of this defines the locale of your format string.

View solution in original post

1 REPLY 1
timl
Super User III
Super User III

Hi @EdwinChua 

This should produce the correct output for you.

Set(d1,Text( Today(), "[$-en-US]dd mmm yyyy", "en-US"));

 

The third argument defines the output locale.

The [$-en-US]  part of this defines the locale of your format string.

View solution in original post

Helpful resources

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

PowerPlatform 768x460.png

Microsoft Learn

Check out our new Discover Your Career Path blog post series and get all the details.

Users online (1,199)