Datediff - MACROMEDIA COLDFUSION 4.5-CFML LANGUAGE Reference

Cfml language reference
Table of Contents

Advertisement

Chapter 2: ColdFusion Functions

DateDiff

Returns the number of intervals in whole units of type Datepart by which Date1 is less
than Date2.
See also DateAdd, DatePart, and CreateTimeSpan.
Syntax
DateDiff( datepart , date1 , date2 )
datepart
One of the following strings:
yyyy
q
m
y
d
w
ww
h
n
s
date1
Date/time object in the period from 100 AD to 9999 AD.
date2
Date/time object in the period from 100 AD to 9999 AD.
Usage
If you want to know the number of days between date1 and date2, you can use either
Day of Year ("y") or Day ("d").
When datepart is Weekday ("w"), DateDiff returns the number of weeks between the
two dates. If date1 falls on a Monday, DateDiff counts the number of Mondays until
date2. It counts date2 but not date1. If interval is Week ("ww"), however, the DateDiff
function returns the number of calendar weeks between the two dates. It counts the
number of Sundays between date1 and date2. DateDiff counts date2 if it falls on a
Sunday; but it doesn't count date1, even if it does fall on a Sunday.
If Date1 refers to a later point in time than date2, the DateDiff function returns a
negative number.
When passing 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.
— Year
— Quarter
— Month
— Day of year
— Day
— Weekday
— Week
— Hour
— Minute
— Second
323

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the COLDFUSION 4.5-CFML LANGUAGE and is the answer not in the manual?

This manual is also suitable for:

Coldfusion 4.5

Table of Contents