| By Charlie Arehart | Article Rating: |
|
| September 23, 2003 12:00 AM EDT | Reads: |
9,024 |
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
Published September 23, 2003 Reads 9,024
Copyright © 2003 SYS-CON Media, Inc. — All Rights Reserved.
Syndicated stories and blog feeds, all rights reserved by the author.
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.
- Validating Input with Regular Expressions
- Getting Focus()ed and a Quick JavaScript Lesson
- Setting Up Your Development Server with ColdFusion 5, MX, and BlueDragon
- Toward Better Error Handling
- Monitoring Your ColdFusion Environment With the Free Log Parser Toolkit
- Testing Existence in Arrays
- New Possibilities for Session/Client Variable Handling in CFMX
- Making the Case for CFML on J2EE
- Exploring Amazon Web Services with ColdFusion MX
- Getting Focused - and a Quick JavaScript Lesson
- CFML on J2EE: Easy as 1-2-3
- Getting into HomeSite+

























