Cicode Programming Reference > Cicode Function Categories > Time and Date Functions Introduction > DateYear

DateYear

Gets the year from a time/date variable.

Time/date functions can only be used with dates between 1980 and 2035. You should check that the date you are using is valid with Cicode similar to the following:

IF StrToDate(Arg1)>0 THEN
...
ELSE
...
END

Syntax

DateYear(Time [, Mode] )

Time:

The time/date variable.

Mode:

The format required:

0 - Short year, yy. If you use this mode during the year 2000, 0 (zero) will be returned.

1 - Long year, yyyy

If omitted, the default Mode is 0.

Return Value

The year as an integer.

Note: In the year 2000, this function will return 0 (zero) if mode 0 (zero) is used.

Related Functions

Date

Example

! If the current system date is 3rd November 1991;
Variable=DateYear(TimeCurrent(),0);
! Sets Variable to 91.
! If the current system date is 18th October 2000;
Variable=DateYear(TimeCurrent(),0);
! Sets Variable to 0.
Variable=DateYear(TimeCurrent(),1);
! Sets Variable to 1991.

See Also

Time/Date Functions