DateTimeOffset.parse

Overview

Parses the specified string and returns a DateTimeOffset object.

DateTimeOffset DateTimeOffset.parse(val: string)

Parses the given string in specified format and returns a DateTimeOffset object.

DateTimeOffset DateTimeOffset.parse(val: string, format: string)

Arguments

string val

date time string

string format

date time format

Returns

DateTimeOffset object

Remarks

If the string is not in a valid format, the method throws an exception.

Example

var dt1 = DateTimeOffset.parse("2012-01-01T00:00:00+03:00");

Example

var dt2 = DateTimeOffset.parse("2012-01-01T00:00:00");

Example

var dt1 = DateTimeOffset.parse("2012-01-01T00:00:00+03:00", "yyyy-MM-ddTHH:mm:sszzz");

Copyright © 2010 - 2023 Emakin. All rights reserved.