bool on success for two arguments overload, and the resulting timestamp for single argument overdload.
DateTimeException if the given string is not in the correct format. Two arguments overload is nothrow.
assert(Timestamp.fromISOString("20100704") == Timestamp(2010, 7, 4)); assert(Timestamp.fromISOString("19981225") == Timestamp(1998, 12, 25)); assert(Timestamp.fromISOString("00000105") == Timestamp(0, 1, 5)); // assert(Timestamp.fromISOString("-00040105") == Timestamp(-4, 1, 5)); assert(Timestamp(2021) == Timestamp.fromISOString("2021")); assert(Timestamp(2021) == Timestamp.fromISOString("2021T")); // assert(Timestamp(2021, 01) == Timestamp.fromISOString("2021-01")); // assert(Timestamp(2021, 01) == Timestamp.fromISOString("2021-01T")); assert(Timestamp(2021, 01, 29) == Timestamp.fromISOString("20210129")); assert(Timestamp(2021, 01, 29, 19, 42) == Timestamp.fromISOString("20210129T1942")); assert(Timestamp(2021, 01, 29, 19, 42) == Timestamp.fromISOString("20210129T1942Z")); assert(Timestamp(2021, 01, 29, 19, 42, 12) == Timestamp.fromISOString("20210129T194212")); assert(Timestamp(2021, 01, 29, 19, 42, 12, -3, 67) == Timestamp.fromISOString("20210129T194212.067Z")); assert(Timestamp(2021, 01, 29, 12, 42, 44).withOffset(7 * 60) == Timestamp.fromISOString("20210129T194244+07")); assert(Timestamp(2021, 01, 29, 12, 42, 44).withOffset(7 * 60 + 30) == Timestamp.fromISOString("20210129T201244+0730")); static 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.fromISOString("20210128T211244-0730"));
Creates a Timestamp from a string with the format `YYYYMMDDThhmmss±hhmm or its leading part allowed by the standard.
or its leading part allowed by the standard.