Welcome!

Charlie Arehart

Subscribe to Charlie Arehart: eMailAlertsEmail Alerts
Get Charlie Arehart via: homepageHomepage mobileMobile rssRSS facebookFacebook twitterTwitter linkedinLinkedIn


Article

Ready for the Leap Year?

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

More Stories By Charlie Arehart

A veteran ColdFusion developer since 1997, Charlie Arehart is a long-time contributor to the community and a recognized Adobe Community Expert. He's a certified Advanced CF Developer and Instructor for CF 4/5/6/7 and served as tech editor of CFDJ until 2003. Now an independent contractor (carehart.org) living in Alpharetta, GA, Charlie provides high-level troubleshooting/tuning assistance and training/mentoring for CF teams. He helps run the Online ColdFusion Meetup (coldfusionmeetup.com, an online CF user group), is a contributor to the CF8 WACK books by Ben Forta, and is frequently invited to speak at developer conferences and user groups worldwide.

Comments (0)

Share your thoughts on this story.

Add your comment
You must be signed in to add a comment. Sign-in | Register

In accordance with our Comment Policy, we encourage comments that are on topic, relevant and to-the-point. We will remove comments that include profanity, personal attacks, racial slurs, threats of violence, or other inappropriate material that violates our Terms and Conditions, and will block users who make repeated violations. We ask all readers to expect diversity of opinion and to treat one another with dignity and respect.