Extracts a part from a datetime value as a numeric.
datePart(datepart, date [,timezone])
→ returns numeric
date.datePart(datepart)
Timezone Specified in Lucee Administrator
1970-1-1 00.00:00 UTC
.setTimezone()
.
date.part(datepart)
.
This example shows information available from datePart
<cfset todayDate = now()>
<h3>datePart Example</h3>
<p>Today's date is <cfoutput>#todayDate#</cfoutput>.
<p>Using datePart, we extract an integer representing the dateparts from that value <cfoutput>
<ul>
<li>year: #datePart("yyyy", todayDate)#</li>
<li>quarter: #datePart("q", todayDate)#</li>
<li>month: #datePart("m", todayDate)#</li>
<li>day of year: #datePart("y", todayDate)#</li>
<li>day: #datePart("d", todayDate)#</li>
<li>weekday: #datePart("w", todayDate)#</li>
<li>week: #datePart("ww", todayDate)#</li>
<li>hour: #datePart("h", todayDate)#</li>
<li>minute: #datePart("n", todayDate)#</li>
<li>second: #datePart("s", todayDate)#</li>
</ul>
</cfoutput>
Signup for cfbreak
to stay updated on the latest news from the ColdFusion / CFML community. One email, every friday.