• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint

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>

PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint