Hi all..
I'm sorry if i'm been around this too often now.. I still figuring all powerapps function due to my company needs.
long story short, i still haven't found satisfying answer to quench my requirements.
So,
I need to comparing text value with date value.
What i have in mind, is i need to convert my text value into date value. and this is what i have right now:
A variable that store a text value like this:
I need to convert that variable value (text: 190301) into date value, so i can use my formula here:
If(DateDiff(Now(), VarExpiryDate, Months)<3,
Notify("Item will be expired in 3 month", NotificationType.Warning);
Set(varEditComment, "Item will be expired in 3 month: [" & Text(VarExpiryDate, "yymmdd") & "]");
I'm thinking to first convert the text value (190301) into date value something like 01/03/2019 so it could be properly compare. Am i right?
How can i achieve this?
Or is there any other way around to make my formula works?
Please help..
Regards
Solved! Go to Solution.
Hi @PytByt ,
Could you please share a bit more about your scenario?
Do you want to convert the Text value (e.g. 190301) into a Date value?
If you wan to convert the Text value (e.g. 190301) into a Date value, I have made a test on my side, please take a try with the following workaround:
Set the Text property of the Label1 to following (result is Date type value):
Date(Value(Left(Text(Year(Today())),2) & Left(TextInput1.Text,2)), Value(Mid(TextInput1.Text, 3,2)), Value(Right(TextInput1.Text, 2)))
On your side, if you want to convert the Text value (VarExpiryDate) into a Date value, you may need to type the following formula:
Date(
Value(Left(Text(Year(Today())),2) & Left(VarExpiryDate, 2)), /* <-- Year */
Value(Mid(VarExpiryDate, 3, 2)), /* <-- Month */
Value(Right(VarExpiryDate, 2)) /* <-- Day */
)
Then you need to modify your If formula as below:
If(
DateDiff(Now(), Date(Value(Left(Text(Year(Today())),2) & Left(VarExpiryDate, 2)),Value(Mid(VarExpiryDate, 3, 2)),Value(Right(VarExpiryDate, 2))), Months) < 3,
Notify("Item will be expired in 3 month", NotificationType.Warning);
Set(varEditComment, "Item will be expired in 3 month: [" & VarExpiryDate & "]"
);
Please consider take a try with above solution, then check if the issue is solved.
Best regards,
Hi @PytByt ,
Could you please share a bit more about your scenario?
Do you want to convert the Text value (e.g. 190301) into a Date value?
If you wan to convert the Text value (e.g. 190301) into a Date value, I have made a test on my side, please take a try with the following workaround:
Set the Text property of the Label1 to following (result is Date type value):
Date(Value(Left(Text(Year(Today())),2) & Left(TextInput1.Text,2)), Value(Mid(TextInput1.Text, 3,2)), Value(Right(TextInput1.Text, 2)))
On your side, if you want to convert the Text value (VarExpiryDate) into a Date value, you may need to type the following formula:
Date(
Value(Left(Text(Year(Today())),2) & Left(VarExpiryDate, 2)), /* <-- Year */
Value(Mid(VarExpiryDate, 3, 2)), /* <-- Month */
Value(Right(VarExpiryDate, 2)) /* <-- Day */
)
Then you need to modify your If formula as below:
If(
DateDiff(Now(), Date(Value(Left(Text(Year(Today())),2) & Left(VarExpiryDate, 2)),Value(Mid(VarExpiryDate, 3, 2)),Value(Right(VarExpiryDate, 2))), Months) < 3,
Notify("Item will be expired in 3 month", NotificationType.Warning);
Set(varEditComment, "Item will be expired in 3 month: [" & VarExpiryDate & "]"
);
Please consider take a try with above solution, then check if the issue is solved.
Best regards,
Hi @PytByt ,
Is the solution I provided above helpful in your scenario?
If the solution I provided above is helpful in your scenario, please consider go ahead to click "Accept as Solution" to identify my solution as Solved.
Best regards,
The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.
This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.
User | Count |
---|---|
183 | |
51 | |
47 | |
32 | |
32 |
User | Count |
---|---|
266 | |
91 | |
78 | |
68 | |
67 |