See Also: Time and Date Functions
The DateSetSecond function returns a new DateTime value that is the original value, dtVar, with the second component changed to iSecond.
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:
Invalid values are allowed in all DateTime parts.
Negative values are wrapped.
Date return type may return error (if out of its range).
Use IsDateValid(), IsNullDateTime() and IsTimeSpanValid() to test if variable is valid.
DateSetSecond( {dtVar}, {iSecond} )
Where:
{dtVar} is a value of type DateTime
{iSecond} is an integer value representing the new Second component of the DateTime
Procedure testDateSetSecond
DateTime dtVar
//Get the current local date and time
Move (CurrentDateTime()) To dtVar
Move (DateSetSecond(dtVar, 20)) To dtVar
// This will print:
// The Second of 2/23/2005 9:16:20 AM is: 20
Showln "The Second of " dtVar " is: " (DateGetSecond(dtVar))
End_Procedure