Page 1 of 1

Date column

Posted: Thu Aug 20, 2009 1:35 pm
by reshma11
How to add 2 years to system current date.

Thanks.

Posted: Thu Aug 20, 2009 1:50 pm
by chulett
Depends on how picky you are about "two years". If you go with the definition that says a year is 365 days, then use DateFromDaysSince() to add 730 days to the system date.

Posted: Thu Aug 20, 2009 1:52 pm
by Sainath.Srinivasan
What does 2 year constitue ? What is 2 years from 29/02/2008 ?

365 days per year or 12 months per year or only 2 years increment.

For first, you can do a DaysFromDateSince().

For other 2 options, search for DateToString() and StringToDate().

Re: Date column

Posted: Thu Aug 20, 2009 2:16 pm
by reshma11
[quote="reshma11"]How to add 2 years to system current date.

Thanks.

only 2 years increment and the format should be YYMM

Posted: Thu Aug 20, 2009 2:27 pm
by Sainath.Srinivasan
I will suggest you try from the given information rather than asking the full solution.

We expect some effort from you also - apart from typing your requirement.

Posted: Thu Aug 20, 2009 2:52 pm
by chulett
Hmmm... then that sounds like just a little substring work and adding 2 to the YY portion before you glue them together.

Posted: Thu Aug 20, 2009 5:32 pm
by ray.wurlod
With a little care where YY is "98" or "99".

Posted: Thu Aug 20, 2009 6:31 pm
by chulett
Ah, true... you'd need to constrain it to the rightmost two digits but that's simple enough.