If you wish to format a date into a different format in PHP is very simple. All you need to do is look bellow. You can use the strtotime function to format a string date into timestamp. After that use the timestamp with date function to get the new format

$oldDate = "2010-03-21"; // year-month-day
$newDate = date("d-m-Y", strtotime($originalDate)); //strtotime convers a string into a timestamp

If you wish to format the current time check this.

You might find interesting:   Check If A Date Is In The Past Or In The Future in PHP

1 COMMENT

LEAVE A REPLY