cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Mrunal
Advocate I
Advocate I

Compare date

How to get current year from predefined function or from textfield containing date . Also how to compare the date with current year? Please suggest some help.

1 ACCEPTED SOLUTION

Accepted Solutions
Bassel
Frequent Visitor

Hello , 

I managed to compare two dates and show and hide a field if the time differenence is more than a year like this :

If(
DateAdd(
TargetItem.LastReview,
365,
Days
) < Now(),
UpdateContext({UpdateBTNgroup: true}),
UpdateContext({UpdateBTNgroup: false})
);

View solution in original post

6 REPLIES 6
MatthieuMegaly
Kudo Collector
Kudo Collector

Hi,

 

you may find what you need here :

https://powerapps.microsoft.com/en-us/tutorials/function-date-time/

https://powerapps.microsoft.com/en-us/tutorials/show-text-dates-times/

 

the function DateDiff can be used to compare 2 dates

 

 

Matthieu Megaly
Steelman70
Power Participant
Power Participant

Hi, in addtition to what MatthieuMegaly suggested you can use the string functions Left, Mid, Right.

Example here https://powerusers.microsoft.com/t5/PowerApps-Forum/Using-numbers-and-dates-from-SharePoint-lists/m-...

hngdev
Resolver II
Resolver II

Hello,

 

To get current date, you can you Now function

To compare date:

- I think you should convert the date text type from textfield (I assume) to date type by using Date function

- Then, use DateDiff function to compare 2 dates.

You can go here (Formular Reference) for more information.

Anonymous
Not applicable

You can use for example:

 

Text( yourDateVariable, "mm/dd/yyyy" ) = Text( Today(), "mm/dd/yyyy" )

Bassel
Frequent Visitor

Hello , 

I managed to compare two dates and show and hide a field if the time differenence is more than a year like this :

If(
DateAdd(
TargetItem.LastReview,
365,
Days
) < Now(),
UpdateContext({UpdateBTNgroup: true}),
UpdateContext({UpdateBTNgroup: false})
);

View solution in original post

Anonymous
Not applicable

Thank you for the useful tip @Bassel

 

@Anonymous

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

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

Did you miss the call? Check out the recording here!

Top Solution Authors
Top Kudoed Authors
Users online (30,391)