-5

How can I get 2017-08-29T09:43:42.335Z date format in PHP. And what does T09:43:42.335Z correspond to?

ess.etch
  • 11
  • 3

1 Answers1

1

T09:43:42.335Z is the time (including milliseconds) in the Zulu timezone (the T is just a separator).

This is not a time format that's built-in in PHP. As of PHP 7.0.0 you could make it yourself like so:

$date->format('Y-m-d\TH:i:s.v\Z');

In earlier PHP versions there is no "milliseconds" option, so you would have to concatenate that yourself.

The Zulu timezone is equal to UTC+0. Make sure you convert your time to UTC+0 before you print this out, the format command won't do that for you.

seven77
  • 380
  • 1
  • 4