cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
FelipeCaru
Level 8

Date in a text label to be used as proper date in DATEDIFF

Hello all,

I am trying to make a DATEDIFF between a chosen date in a DateValue control as date 1, and a date that is read from an Excel sheet (and it is formatted as date) that is, it seems, text, as date 2. I can't do the DATEDIFF due to this. What can I do?

Sin título.png

"Fin plan" is from the datacard with same name that has inside a label "datacardvalue" and "datacardkey", and if I use the label from it, and a ". " for properties, the first one to show up is ".Text" so it is not valid, it seems, for a datediff. What can I do?

1 ACCEPTED SOLUTION

Accepted Solutions
Super User
Super User

Re: Date in a text label to be used as proper date in DATEDIFF

@FelipeCaru 

Yes, that's exactly right.  For "21/02/2019" - when doing a DateValue on that in en-US, you will get Sept 2 2020

What you will need to do is specify the locale for that date...

DateValue(finPlan.Text, "yourlanguageTag")

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
4 REPLIES 4
Super User
Super User

Re: Date in a text label to be used as proper date in DATEDIFF

@FelipeCaru 

You will want to convert the text to a DateValue.  DateDiff needs date values to compare.

So, consider this formula:

DateDiff(DateValue(finPlan.Text), DateValue(finReal.Text), Days)

So in the above, substitute the two text items with the field, column, control, or whatever else you have that is giving you a Text Date.

 

I hope this is helpful for you.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
FelipeCaru
Level 8

Re: Date in a text label to be used as proper date in DATEDIFF

@RandyHayes I used a label to test if the DateValue worked, but it didn't give back the same date. Would it be because the one in text is on spanish format (dd/mm/yyyy)? The DateValue one gave me a date on 2020 or so

Super User
Super User

Re: Date in a text label to be used as proper date in DATEDIFF

@FelipeCaru 

Yes, that's exactly right.  For "21/02/2019" - when doing a DateValue on that in en-US, you will get Sept 2 2020

What you will need to do is specify the locale for that date...

DateValue(finPlan.Text, "yourlanguageTag")

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
Highlighted
FelipeCaru
Level 8

Re: Date in a text label to be used as proper date in DATEDIFF

That was exactly what I needed/was missing @RandyHayes , thank you very much

Helpful resources

Announcements
firstImage

PowerApps Monthly Community Call!

Join us next Wednesday for our Demo Extravaganza, October 16, 2019 8am PDT.

Top Community Contributors for September  2019

Top Community Contributors for September 2019 🎉🎉

Let's thank our top community contributors

firstImage

Microsoft Business Applications Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

FirstImage

Power Platform World Tour

Coming to a city near you

thirdimage

PowerApps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

FourthImage

Join PowerApps User Group!!

Connect, share, and learn with your peers year-round

SecondImage

Power Platform Summit North America

Register by September 5 to save $200

Top Kudoed Authors
Users Online
Currently online: 304 members 4,372 guests
Recent signins:
Please welcome our newest community members: