Peter van Mil
2-Dec-2015, 01:38 PM
The new DateTime functions are great. Today I had a February 29 problem and I have checked how the new functions work.
If you add three years to the date 02/29/2012 you get 02/29/2015 without an error. If you add one day to this invalid date you get an error.
This isn't a big issue, but I should say the a date like 02/29/2015 shouldn't be accepted (= generate an error).
Procedure OnClick
DateTime dtDate
Integer iYear iMonth iDay
Move 2012 to iYear
Move 2 to iMonth
Move 29 to iDay
Move (DateSet(iYear, iMonth, iDay)) to dtDate
Showln dtDate
Move (DateAddYear(dtDate, 3)) to dtDate
Showln dtDate
Move (DateAddDay(dtDate, 1)) to dtDate
Showln dtDate
End_Procedure
If you add three years to the date 02/29/2012 you get 02/29/2015 without an error. If you add one day to this invalid date you get an error.
This isn't a big issue, but I should say the a date like 02/29/2015 shouldn't be accepted (= generate an error).
Procedure OnClick
DateTime dtDate
Integer iYear iMonth iDay
Move 2012 to iYear
Move 2 to iMonth
Move 29 to iDay
Move (DateSet(iYear, iMonth, iDay)) to dtDate
Showln dtDate
Move (DateAddYear(dtDate, 3)) to dtDate
Showln dtDate
Move (DateAddDay(dtDate, 1)) to dtDate
Showln dtDate
End_Procedure