User Guide Cancel

SetYear

 

Description

Sets the year on the Date object. This is a member function called by the Date object.

Returns

DateObject

History

New in Adobe ColdFusion (2016 release)

Category

Date and time functions

Syntax

setYear (year)
setYear (year)
setYear (year)

Parameter

Parameter

Description

Year

Required. An integer representing the year.

Example

<cfscript>
myDate=now();
WriteOutput(myDate.setYear(2016));
</cfscript>
<cfscript> myDate=now(); WriteOutput(myDate.setYear(2016)); </cfscript>
<cfscript>
       myDate=now();
       WriteOutput(myDate.setYear(2016));
</cfscript>

Output

{ts '2016-11-06 07:21:08'}

Get help faster and easier

New user?