DateTimeAddDays

 

Creates a new DateTime object by adding or subtracting the given number of days from the provided DateTime object.

 

object @DateTimeAddDays(object datetime);

 

Parameters

object datetime: The DateTime object to be manipulated.

 

Return Value

Returns a new DateTime object after adding or subtracting the specified number of days.

 

Example

t = @DateTimeNow();

t = @DateTimeAddDays(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: Retrieves the current time, creates a new DateTime object by adding 10 days, and displays each element as a message.

 

Version Information

Supported Version: 10.3.0 or Higher

 

Related Helps

@DateTimeAddDays()

@DateTimeAddHours()

@DateTimeAddMilliseconds()

@DateTimeAddMinutes()

@DateTimeAddMonths()

@DateTimeAddSeconds()

@DateTimeAddYears()

@DateTimeDay()

@DateTimeDayOfWeek()

@DateTimeDayOfYear()

@DateTimeHour()

@DateTimeMillisecond()

@DateTimeMinute()

@DateTimeMonth()

@DateTimeNew()

@DateTimeNow()

@DateTimeSecond()

@DateTimeUtcNow()

@DateTimeYear()