DateSetMonth

See Also: Time and Date Functions

Purpose

The DateSetMonth function returns a new DateTime value that is the original value, dtVar, with the month component changed to iMonth.

Return Type

DateTime

 

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:

Syntax

DateSetMonth( {dtVar}, {iMonth} )

Where:

Example

Procedure testDateSetMonth

    DateTime dtVar

 

    //Get the current local date and time

    Move (CurrentDateTime()) To dtVar

    Move (DateSetMonth(dtVar, 4)) To dtVar

 

    // This will print:

    // The Month of 4/23/2005 9:15:15 AM is: 4

    Showln "The Month of " dtVar " is: " (DateGetMonth(dtVar))

End_Procedure

Notes