Skip to Main Content
Programming ColdFusion MX, 2nd Edition
book

Programming ColdFusion MX, 2nd Edition

by Rob Brooks-Bilson
August 2003
Intermediate to advanced content levelIntermediate to advanced
1140 pages
68h 45m
English
O'Reilly Media, Inc.
Content preview from Programming ColdFusion MX, 2nd Edition

Name

DateCompare

Synopsis

                  
                  
                  DateCompare(date1, date2 [, datepart])

Compares two date/time objects. Returns -1 if date1 is less than date2, 0 if both date/time objects are equal, or 1 if date1 is greater than date2. Dates must be in the range AD 100-9999. The precision of the comparison may be limited to a specific part of the date/time object by specifying a value for the optional datepart parameter. Valid attributes for datepart are s (second), n (minute), h (hour), d (day), m (month), and yyyy (year). For information on how ColdFusion MX handles two-digit years, see CreateDate( ). Examples:

<cfoutput>
Compare 04/15/03 and 04/15/03: #DateCompare('04/15/03', '04/15/03')#<br>
Compare 04/15/03 and 04/15/2003: #DateCompare('04/15/03', '04/15/2003')#<br>
Compare 15 Apr 2003 and 4/15/03: #DateCompare('15 Apr 2003', '4/15/03')#<br>
Compare August 15, 2003 and July 4, 2002: 
#DateCompare('August 15, 2003', 'July 4, 2002')#<br>
Compare 19:00:00 and 7pm: #DateCompare('19:00:00', '7pm')#<br>
Compare 6:00 and 7:00: #DateCompare('6:00', '7:00')#<br>
Compare 4/15/2003 and Jan 3, 2003 by year: 
#DateCompare('4/15/2003', 'Jan 3, 2003', 'yyyy')#<br>
Compare 6:59 and 7:38 by minute: #DateCompare('6:59', '7:38', 'n')#
</cfoutput>
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Programming ColdFusion

Programming ColdFusion

Rob Brooks-Bilson

Publisher Resources

ISBN: 0596003803Supplemental ContentErrata Page