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

DateDiff error, how to fix??

Picture22.pngPicture11.png

1 ACCEPTED SOLUTION

Accepted Solutions
v-siky-msft
Community Support
Community Support

Hi @suthichaia ,

 

 Have your issue been resolved? If not, I'm happy to help further.

I am very much behind@TiagoFreire 's opinion, this issue is due to the date formatting between languages. 

In Thai, the default date format is "m/d/y", but what in EN is 'd/m/y'.

Hence, in order to be able to unify it, there is an optional argument Language in DataValue function to specify the date format of output. 

Try to modify the code as follow.

DateDiff(DateValue("7/24/2020","en"),DateValue("7/31/2020","en"))

Hope this helps.

Sik

View solution in original post

2 REPLIES 2
TiagoFreire
Continued Contributor
Continued Contributor

Thay likely uses d/m/y like the the sane part of the world. (j/k) ; US English has this wonky month/day/year that is wrong in every level, but it is what it is 🙂 

 

The problem here is in letting DateValue(<some string or label reference>) interpret the language implicitly. 

DateValue() accepts an optional parameter, to set the language to be used in the conversion. 

 

Use the same DateTimeFormat everywhere. The example uses one when formatting the Text for the Label, but not to interpret all the strings. 

 

https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-datevalue-timevalue

v-siky-msft
Community Support
Community Support

Hi @suthichaia ,

 

 Have your issue been resolved? If not, I'm happy to help further.

I am very much behind@TiagoFreire 's opinion, this issue is due to the date formatting between languages. 

In Thai, the default date format is "m/d/y", but what in EN is 'd/m/y'.

Hence, in order to be able to unify it, there is an optional argument Language in DataValue function to specify the date format of output. 

Try to modify the code as follow.

DateDiff(DateValue("7/24/2020","en"),DateValue("7/31/2020","en"))

Hope this helps.

Sik

View solution in original post

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Microsoft Ignite 768x460.png

Find your focus

Explore the latest tools,training sessions,technical expertise, networking and more.

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

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.

Users online (2,111)