Wednesday, January 20, 2016

PHP DATE AND TIME FORMAT: Format Date From Database

Usually, the format that we used to save date in our table is Y-m-d in which the result is something like this: 2016-01-21. So to make your date more readable to users, you need to format it.

Code

<?php 
$date_posted="1970-01-01";//Let's just assume that the value from the table is like that.
echo date("M d, Y",strtotime($date_posted));
?>
Output



PHP DATE FORMAT: Format Date From Database

PHP DATE AND TIME FORMAT: Format Date From Database Rating: 4.5 Diposkan Oleh: Emoblazz

0 comments:

Post a Comment