'Convert datetime json string to date
I got JSON object with date property like this
"date": 1402680443
How can I convert it with PHP to show just the date in Jan 00 0000 format ?
Solution 1:[1]
If you receive json and need converting date, try this:
$date = new DateTime();
$date->setTimestamp(1402680443);
echo $date->format('Y-m-d H:i:s');
Set to setTimestamp() method date value from your json object.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | galkindev |
