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

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Power Apps June 2021

June Power Apps Community Call

Don't miss the call this month on June 16th - 8a PDT

Top Solution Authors
Top Kudoed Authors
Users online (15,701)