PHP - epoch to date with PHP substr

0 votes
246 views
added Mar 25, 2019 in PHP by LC Marshal Captain (25,790 points)
<?php
// "node_created":"1553498100" get value from API
$newsdate = $row->node_created;
?>
<p class="news-date"><?php print date("F j, Y", substr($newsdate, 0, 10)); ?></p> 
// output $newsdate March 25, 2019

 

For more date function variation, learn it at PHP.net 

lazacode.org - Malaysia's programming knowledge sharing platform, where everyone can share their finding as reference to others.
...