DateSetMinute
See Also: Time and Date Functions
Purpose
The DateSetMinute function returns a new DateTime value that is the original value, dtVar, with the minute component changed to iMinute.
Return Type
Returns a value of type DateTime or TimeSpan.
We recommend using the newer, higher-level DateSet function to set a date and the DateAddXXX functions (DateAddDay, DateAddHour, DateAddMillisecond, DateAddMinute, DateAddMonth, DateAddSecond, DateAddYear) to manipulate DateTimes/Dates. Additionally, use the DateGetXXX functions (DateGetDay, DateGetHour, DateGetMillisecond, DateGetMinute, DateGetMonth, DateGetSecond, DateGetYear) to retrieve DateTimes/Dates.
The DateSetXXX functions (DateSetDay, DateSetHour, DateSetMillisecond, DateSetMinute, DateSetMonth, DateSetSecond, DateSetYear) have the following limitations:
- Invalid values are allowed in all DateTime parts.
- Negative values are wrapped.
- Can be used with DateTime or TimeSpan without error.
- Date return type may return an error (if out of its range).
- Use IsDateValid(), IsNullDateTime(), and IsTimeSpanValid() to test if a variable is valid.
Syntax
DateSetMinute( {dtVar}, {iMinute} )
Where:
{dtVar}is a value of type DateTime.{iMinute}is an integer value representing the new minute component of the DateTime.
Example
Procedure testDateSetMinute
DateTime dtVar
// Get the current local date and time
Move (CurrentDateTime()) To dtVar
Move (DateSetMinute(dtVar, 20)) To dtVar
// This will print:
// The Minute of 2/23/2005 9:20:09 AM is: 20
Showln "The Minute of " dtVar " is: " (DateGetMinute(dtVar))
End_Procedure