Time.fromString()

Construct a Time from an ISO 8601 timestamp String.

Signature

Time.fromString(time: String) => Time

Description

Converts an ISO 8601 timestamp String to a Time value.

Parameter fields:

Time field Description

yyyy

Four-digit year.

MM

Month, from 01 to 12.

dd

Day, from 01 to 31.

T

Date and time separator.

hh

Hours, from 00 to 23.

mm

Minutes, from 00 to 59.

ss

Seconds, from 00 to 59, which can also be expressed as a decimal fraction to give nanosecond resolution.

TZO

Timezone offset from UTC which can be one of:

Timezone Description

Z

UTC, no offset

+hhmm

Positive hour and minute offset from UTC.

-hhmm

Negative hour and minute offset from UTC.

This method is equivalent to Time().

Parameters

Parameter Type Required Description

time

String

true

Timestamp string in the form yyyy-MM-ddThh:mm:ssTZO.

Return value

Type Description

Time

Time representation of the timestamp string.

Examples

Convert a time String to a Time value:

Time.fromString("2099-10-20T21:15:09.890729Z")
Time("2099-10-20T21:15:09.890729Z")
\