Description

From a date/time object, gets the year value.

Returns

The year value of date.

Category

Date and time functions

Function syntax

Year(date)

See also

DatePartIsLeapYear

Parameters

Parameter

Description

date

A date/time object in the range 100 AD-9999 AD.

Usage

When passing a date as a string, enclose it in quotation marks. Otherwise, it is interpreted as a number representation of a date.

Example

<cfscript>
    myDateTime = now();
    WriteOutput(Year(myDateTime & "<br/>"));
</cfscript>

Output

2018

This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License  Twitter™ and Facebook posts are not covered under the terms of Creative Commons.

Legal Notices   |   Online Privacy Policy