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

DatePart

Synopsis

                  
                  DatePart(datepart, date)

Returns the specified part of a valid date/time object. The value supplied for date must be in the range AD 100-9999. Valid values for the datepart parameter are l (millisecond), s (second), n (minute), h (hour), ww (week), w (weekday), d (day), y (day of year), m (month), q (quarter), and yyyy (year). For information on how ColdFusion MX handles two-digit years, see CreateDate( ). Examples:

<cfoutput>
The current time and date  is 
#TimeFormat(Now( ),'hh:mm:ss tt')#, #DateFormat(Now( ),'mmmm dd, yyyy')#
<p>
   
<b>Second:</b> #DatePart('s', Now( ))#<br>
<b>Minute:</b> #DatePart('n', Now( ))#<br>
<b>Hour:</b> #DatePart('h', Now( ))#<br>
<b>Week:</b> #DatePart('ww', Now( ))#<br>
<b>Weekday:</b> #DatePart('w', Now( ))#<br>
<b>Day:</b> #DatePart('d', Now( ))#<br>
<b>Day of year:</b> #DatePart('y', Now( ))#<br>
<b>Month:</b> #DatePart('m', Now( ))#<br>
<b>Quarter:</b> #DatePart('q', Now( ))#<br>
<b>Year:</b> #DatePart('yyyy', Now( ))#
</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