DateTime

Represents a point in time with date and time components.

xxml
Language::Time

Static

MethodParametersReturnsDescription
nowDateTime^Current date/time

Methods

MethodParametersReturnsDescription
Constructory: Integer^, m: Integer^, d: Integer^DateTime^From date components
Constructory: Integer^, m: Integer^, d: Integer^, h: Integer^, min: Integer^, s: Integer^DateTime^From date and time
yearInteger^Get year
monthInteger^Get month (1-12)
dayInteger^Get day (1-31)
hourInteger^Get hour (0-23)
minuteInteger^Get minute (0-59)
secondInteger^Get second (0-59)
dayOfWeekInteger^Day of week (0=Sunday)
addDaysdays: Integer^DateTime^Add days
addHourshours: Integer^DateTime^Add hours
addMinutesminutes: Integer^DateTime^Add minutes
addSecondsseconds: Integer^DateTime^Add seconds
subtractother: DateTime^TimeSpan^Difference as TimeSpan
isBeforeother: DateTime^Bool^Comparison
isAfterother: DateTime^Bool^Comparison
formatpattern: String^String^Format to string
toStringString^ISO 8601 format

Examples

DateTime Usage

xxml
Instantiate Time::DateTime^ As <now> = Time::DateTime::now();
Run Console::printLine(String::Constructor("Current: ").append(now.toString()));

Instantiate Time::DateTime^ As <tomorrow> = now.addDays(Integer::Constructor(1));
Instantiate Time::DateTime^ As <birthday> = Time::DateTime::Constructor(
    Integer::Constructor(2000),
    Integer::Constructor(6),
    Integer::Constructor(15)
);

See Also