Closed jakeworrall closed 5 years ago
Hi,
I am trying to retrieve an instant from an ISO datetime string, eg "2019-05-10T11:00:00Z".
I have found a way to do this using the IsoParsers::offsetDateTime() parser but it seems a bit longwinded:
IsoParsers::offsetDateTime()
$parseResult = IsoParsers::offsetDateTime()->parse($dateTimeString); $instant = ZonedDateTime::from($parseResult)->getInstant();
Is this the best way to do this?
Thanks, Jake
Hi Jake, yes there is 👍
$instant = ZonedDateTime::parse('2019-05-10T11:00:00Z')->getInstant();
Hi,
I am trying to retrieve an instant from an ISO datetime string, eg "2019-05-10T11:00:00Z".
I have found a way to do this using the
IsoParsers::offsetDateTime()
parser but it seems a bit longwinded:Is this the best way to do this?
Thanks, Jake