DateTimeNew

 

Creates a new DateTime object with the given date and time.

 

object @DateTimeNew(int year, int month, int day, int hour, int minute, int second);

 

Parameters

int year: Year (1-9999)

int month: Month (1-12)

int day: Day (1-31)

int hour: Hour (0-23)

int minute: Minute (0-59)

int second: Second (0-59)

 

Return Value

Returns the created DateTime object.

 

Example

t = @DateTimeNew(2015,12,18,0,0,0);
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: Creates a DateTime object for December 18, 2015, 0:00:00 and reads each element to display it 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()