Recent Posts

Showing posts with label strtotime. Show all posts
Showing posts with label strtotime. Show all posts

Convert date format yyyy-mm-dd to dd-mm-yyyy

Use strtotime() and date():

$originalDate = "2010-03-21";
$newDate = date("d-m-Y", strtotime($originalDate));
(see strtotime and date docs on the PHP site).

PHP: Convert date to timestamp

PHP's strtotime() gives

$timestamp = strtotime('22-09-2008');
Which does work with the Supported Date and Time Formats Docs.