Algosim documentation: datetime

datetime

Returns the current time or a given point in time as a datetime structure.

Syntax

Description

datetime() returns the current time as a DateTime structure.

If t is a DateTime structure, a Date structure, or a timestamp, then datetime(t) returns t as a DateTime structure.

If d is a Date structure and t is a Time structure, then datetime(d, t) returns the DateTime structure with date member d and time member t.

datetime(y, m, d[, h[, n[, s[, ms]]]]) returns the DateTime structure for the specified point in time. Omitted values default to 0.

Examples

datetime(1985, 06, 07, 18, 20)
date.year: 1985
date.month: juni
date.day: 7
time.hour: 18
time.minute: 20
time.second: 0
time.millisecond: 0
datetime()
date.year: 2020
date.month: September
date.day: 7
time.hour: 15
time.minute: 52
time.second: 20
time.millisecond: 396
datetime() = now()
true
datetime(0)
date.year: 1899
date.month: December
date.day: 30
time.hour: 0
time.minute: 0
time.second: 0
time.millisecond: 0
datetime(now()) = now()
true
datetime(date()) = TruncToDay(now())
true
datetime(tomorrow(), time())
date.year: 2020
date.month: September
date.day: 8
time.hour: 15
time.minute: 52
time.second: 20
time.millisecond: 396

See also