DateSetYear

See Also: Time and Date Functions

Purpose

The DateSetYear function returns a new DateTime value that is the original value, dtVar, with the year component changed to iYear.

 

We recommend using the newer, higher level DateSet function to set a date and the DateAddXXX (DateAddDay, DateAddHour, DateAddMillisecond, DateAddMinute, DateAddMonth, DateAddSecond, DateAddYear) functions to manipulate DateTimes/Dates and the DateGetXXX (DateGetDay, DateGetHour, DateGetMillisecond, DateGetMinute, DateGetMonth, DateGetSecond, DateGetYear) functions to retrieve DateTimes/Dates.

The DateSetXXX (DateSetDay, DateSetHour, DateSetMillisecond, DateSetMinute, DateSetMonth, DateSetSecond, DateSetYear) functions have the following limitations:

Return Type

DateTime

Syntax

DateSetYear( {dtVar}, {iYear} )

Where:

Example

Procedure testDateSetYear

    DateTime dtVar

 

    //Get the current local date and time

    Move (CurrentDateTime()) To dtVar

    Move (DateSetYear(dtVar, 2000)) To dtVar

 

    // This will print:

    // The year of 2/23/2000 9:20:09 AM is: 2000

    Showln "The year of " dtVar " is: " (DateGetYear(dtVar))

End_Procedure

Notes