Year()

<< Click to Display Table of Contents >>

Navigation:  Available Functions >

Year()

Syntax

Year( <DateValue> )

 

Purpose

To determine the Year of a given date value.

 

Parameters

<DateValue> may be the name of a date field (such as the .Donation_Date. field), but it may also be any value of Date type -- such as the current date returned by the "Date()" function.

 

Returns

A numeric value.

 

Usage

Year() returns the year of the specified date value including the century digits as a four-digit numeric value. A field with an Empty date returns zero. Year() is a member of a group of functions that return components of a date value as numeric values. The group includes DAY() and MONTH() to return the day and month values as numeric values.

 

Example

The following examples show the Year() function used in several; ways:

 

CALL

RESULT

.Donation_Date.

09/20/2014

Year( .Donation_Date. )

2014

Year( .Donation_Date. ) + 8

2022

 

This example uses Day() in combination with CMonth() and Year() to format a donation date value for the Report Writer:

 

CMonth( .Donation_Date. ) + Str( Day( .Donation_Date. ) ) + ", " + Str( Year( .Donation_Date. ) )

 

The result would be similar to:

September 20, 2014