Question

How to add year in a date and compare with current date

Hi,

I have requirement like i have to fetch the date of a transaction from DB table in which I have to add certain year(eg: 7 yrs.) in activity and then compare it with current date (eg: Currentdate>transaction+7yrs) and based on that comparision I have to update the status of that transaction..

ow to add year in a date and compare it with current date.

Regards,

SorenTara

**Moderation Team has archived post**

This post has been archived for educational purposes. Contents and links will no longer be updated. If you have the same/similar question, please write a new post.

Correct Answer
April 17, 2018 - 5:00pm

You can use below functions to achieve your requirement.

param.FutureDate= @DateTime.addCalendar(@DateTime.CurrentDate("","EST"),7,0,0,0,0,0,0)

param.IsValidTransaction= @differenceBetweenDateTimes(@CurrentDateTime(),param.FutureDate,true,"")>0

I hope this will help.

Comments

Keep up to date on this post and subscribe to comments

April 17, 2018 - 5:00pm

You can use below functions to achieve your requirement.

param.FutureDate= @DateTime.addCalendar(@DateTime.CurrentDate("","EST"),7,0,0,0,0,0,0)

param.IsValidTransaction= @differenceBetweenDateTimes(@CurrentDateTime(),param.FutureDate,true,"")>0

I hope this will help.

April 18, 2018 - 10:06am
Response to AKSHAY

Thanks  AkshayPega... 

April 18, 2018 - 10:05am
Response to Vikash Karn

Thanks VikashKarn

April 20, 2018 - 10:16am