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

ess.etch
- 11
- 3
-
2What have you tried so far? Show us code – B001ᛦ Oct 06 '17 at 09:42
-
1Have you tried to search a littl my friend? – Himanshu Upadhyay Oct 06 '17 at 09:42
-
It's a timestamp format. You can find the meaning of T & Z in [this post](https://stackoverflow.com/questions/29281935/what-exactly-does-the-t-and-z-mean-in-timestamp). – auurk Oct 06 '17 at 09:43
1 Answers
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