Creates a new DateTime object by adding or subtracting a number of hours from the given DateTime object.
object @DateTimeAddHours(object datetime);
Parameters
object datetime: The created DateTime object
Return Value
Returns a new DateTime object after adding or subtracting the number of hours.
Example
t = @DateTimeNow();
t = @DateTimeAddHours(t, 10);
year = @DateTimeYear(t);
month = @DateTimeMonth(t);
day = @DateTimeDay(t);
hour = @DateTimeHour(t);
minute = @DateTimeMinute(t);
second = @DateTimeSecond(t);
millisecond = @DateTimeMillisecond(t);
dow = @DateTimeDayOfWeek(t);
doy = @DateTimeDayOfYear(t);
@sprintf(buf,
"%d-%d-%d %02d:%02d:%02d.%03d dow=%d,doy=%d", year, month, day, hour, minute,
second, millisecond, dow, doy);
@Message(buf);
Description: Gets the current time, adds 10 hours to create a new DateTime object, and reads each element to display it as a message.
Version Information
Supported Version: 10.3.0 or Higher
Related Helps