I have this format:
How do I use PHP DateTime
to format like 2023-01-27T17:37:00.000Z
So far I have
$date = new DateTime();
$string = $date->format('Y-m-dTHH:H:i:s');
but it outputs 2022-11-25UTC0000:00:00:00
What is the correct format
Is there a ressource on the web that would find it for me ? like a helper website.
2
Answers
You can do as follows:
You can use the DateTime class to format the date like this: