Ready for the Leap Year?

While we all made it through the new year, there is still at least one more date issue to contend with. Many systems may not properly recognize that this year, 2000, is a leap year. There are 29 days in February. The good news is that Allaire's date functions do properly recognize this, at least as tested by the following code:


<cfoutput>
Day after 2/28/00: #dateformat(dateadd('d',1,'02/28/00'))#
(dateadd('d',1,'02/28/00'))

Day after 2/29/00: #dateformat(dateadd('d',1,'02/29/00'))# (dateadd('d',1,'02/29/00'))
Day after 2/28/01: #dateformat(dateadd('d',1,'02/28/01'))# (dateadd('d',1,'02/28/01')) </cfoutput>

This tests what the DateAdd function thinks is the day after 2/28/00, 2/29/00 and, for good measure, 2/28/01. The answers, which are correct, are:

Day after 2/28/00: 29-Feb-00 (dateadd('d',1,'02/28/00'))
Day after 2/29/00: 01-Mar-00 (dateadd('d',1,'02/29/00'))
Day after 2/28/01: 01-Mar-01 (dateadd('d',1,'02/28/01'))

Charlie Arehart
Education Director, Fig Leaf Software

© 2008 SYS-CON Media