Year()

Category: Date

Syntax: Year ( date )

Parameters:

dateAny valid date (1/1/000112/31/4000). The parameter should be a string containing a date (for example, "3/17/2004"), an expression with a date result (for example, Date (6, 29, 1969)), or an integer that represents a serialized date value (for example, 718977).

Data type returned: Number

Description:

Returns the year portion of the date parameter.

The Year() function is often used in conjunction with the Date() function to assemble new date values. For instance, if you have a field called DateOfBirth that contains someones birthdate, you can calculate the date of that persons birthday in the current year as follows:

Date (Month (DateOfBirth), Day (DateOfBirth), Year (Get (CurrentDate)))

Examples:

Function

Results

Year ("1/1/2004")

Returns 2004.

Year (Get(CurrentDate))

Returns the current year.

Year (myBirthdate)

Returns the year portion of the field myBirthdate.

Категории