Adds units of time to a date.
A date/time object.
DateAdd(datepart, number, date)
DateConvert, DatePart, CreateTimeSpan
ColdFusion MX 6.1: Added the datepart character L or l to represent milliseconds.
Parameter |
Description |
|---|---|
datepart |
String:
|
number |
Number of units of datepart to add to date (positive, to get dates in the future; negative, to get dates in the past). Number must be an integer. |
date |
Date/time object, in the range 100 AD-9999 AD. |
The datepart specifiers y, d, and w add a number of days to a date.When passing a date/time object as a string, enclose it in quotation marks. Otherwise, it is interpreted as a numeric representation of a date/time object.
<cfscript>
date="{ts '2433-09-01 23:59:59'}";
writeOutput("#date#");
diff=30;
posdateresult=DateAdd("s",diff,date);
writeOutput("#posdateresult#");
</cfscript>
Output
{ts '2433-09-01 23:59:59'}{ts '2433-09-02 00:00:29'}
Sign in to your account