Adds units of time to a date.
dateAdd(datepart, number, date)
→ returns date
date.add(datepart, number)
Add 30 days to August 3rd, 2014.
dateAdd('d', 30, '8/3/2014')
Expected Result: {ts '2014-09-02 00:00:00'}
Subtract 30 days from August 3rd, 2014.
dateAdd('d', -30, '8/3/2014')
Expected Result: {ts '2014-07-04 00:00:00'}
Here we're adding 8 weeks to the date August 3rd, 2014.
dateAdd('ww', 8, '8/3/2014')
Expected Result: {ts '2014-09-28 00:00:00'}
Here we're adding 1 day to the current date/time.
createDate( 2022, 10, 1 ).add( 'd', 1 )
Expected Result: {ts '2022-10-02 00:00:00'}
Signup for cfbreak
to stay updated on the latest news from the ColdFusion / CFML community. One email, every friday.