Extracts the year from the given DateTime object.
int @DateTimeYear(object datetime);
Parameters
object datetime: The DateTime object from which to extract the year.
Return Value
Returns the year extracted from the DateTime object.
Example
t = @DateTimeNow();
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 DateTime object, reads each component, and displays them in a formatted message.
Version Information
Supported Version: 10.3.0 or higher
Related Helps