Datepart - MACROMEDIA COLDFUSION 4.5-CFML LANGUAGE Reference

Cfml language reference
Table of Contents

Advertisement

Chapter 2: ColdFusion Functions

DatePart

Returns the specified part of a date as an integer.
See also
Syntax
DatePart( datepart , date )
datepart
One of the following strings:
yyyy
q
m
y
d
w
ww
h
n
s
date
Any date.
Usage
Years from 0 to 29 are interpreted as 21
th
as 20
century values.
When passing a date/time value as a string, make sure it is enclosed in quotes.
Otherwise, it is interpreted as a number representation of a date/time object, returning
undesired results.
Examples
<!--- This example shows information available from DatePart --->
<HTML>
<HEAD>
<TITLE>
DatePart Example
</TITLE>
</HEAD>
<CFSET todayDate = Now()>
<BODY>
<H3>DatePart Example</H3>
<P>Today's date is <CFOUTPUT>#todayDate#</CFOUTPUT>.
DateAdd
and DateConvert.
— Year
— Quarter
— Month
— Day of year
— Day
— Weekday
— Week
— Hour
— Minute
— Second
st
century values. Years 30 to 99 are interpreted
327

Advertisement

Table of Contents
loading

This manual is also suitable for:

Coldfusion 4.5

Table of Contents