parse method

Constructs a new DateTime instance based on formattedString.

DateTime parse(
String formattedString
)

Constructs a new DateTime instance based on formattedString.

Throws a FormatException if the input cannot be parsed.

The function parses a subset of ISO 8601 which includes the subset accepted by RFC 3339.

The accepted inputs are currently:

This includes the output of both toString and toIso8601String, which will be parsed back into a DateTime object with the same time as the original.

The result is always in either local time or UTC. If a time zone offset other than UTC is specified, the time is converted to the equivalent UTC time.

Examples of accepted strings: