The OpenD Programming Language

Timestamp.this

Examples

assert(Timestamp("2010-07-04") == Timestamp(2010, 7, 4));
assert(Timestamp("20100704") == Timestamp(2010, 7, 4));
assert(Timestamp(2021, 01, 29, 12, 42, 44).withOffset(7 * 60 + 30) == Timestamp.fromISOString("20210129T201244+0730"));
static assert(Timestamp(2021, 01, 29,  4, 42, 44).withOffset(- (7 * 60 + 30)) == Timestamp.fromISOExtString("2021-01-28T21:12:44-07:30"));

assert(Timestamp("T0740") == Timestamp.onlyTime(7, 40));
assert(Timestamp("T074030Z") == Timestamp.onlyTime(7, 40, 30).withOffset(0));
assert(Timestamp("T074030.056") == Timestamp.onlyTime(7, 40, 30, -3, 56));

assert(Timestamp("07:40") == Timestamp.onlyTime(7, 40));
assert(Timestamp("07:40:30") == Timestamp.onlyTime(7, 40, 30));
assert(Timestamp("T07:40:30.056Z") == Timestamp.onlyTime(7, 40, 30, -3, 56).withOffset(0));

Meta