What format is this date time in PHP 2012-08-16T21:14:03.447?
How can I convert it to Timestamp and vice versa?
I have a timestamp format 1345108443790, how to get the Date time ?
For the people who downvoted/close request this question:
I was getting weird result when trying to convert 1345108443790 (I got this value from third-party website) to DateTime, but after many attempts and @Truth’s suggestion got to know that after trimming last 3 digits (may be microseconds?) and then passing it in function actually solved it and is giving the right result. Something to learn here, one click downvoters!
This is similar to ISO 8601 (Timezone is missing though), a.k.a. the standard for date/time stamps.
Use
strtotime()it parses it correctly. You may want to considerDateTimeobjects as well.Working example: