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

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

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

V3_PVA CAmpaign Carousel.png

Community Challenge - Giveaways!

Participate in the Power Virtual Agents Community Challenge

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.

Carousel April Dunnam Updated 768x460.jpg

Urdu Hindi D365 Bootcamp

Dont miss our very own April Dunnam’s The Developer Guide to the Galaxy! Find out what the Power Platform has to offer for the traditional developer.

Top Solution Authors
Top Kudoed Authors
Users online (2,311)