Skip to content

Instantly share code, notes, and snippets.

@anytizer
Created November 30, 2013 07:10
Show Gist options
  • Select an option

  • Save anytizer/7716256 to your computer and use it in GitHub Desktop.

Select an option

Save anytizer/7716256 to your computer and use it in GitHub Desktop.
Format date into your desired pattern
<?php
/**
* Converts YYYY-MM-DD format into DD/MM/YYYY
*/
function _dmy($yyyymmddhhiiss='0000-00-00 00:00:00')
{
$date = substr($yyyymmddhhiiss, 0, 10);
list($yyyy, $mm, $dd) = explode('-', $date);
$dmy = "{$dd}/{$mm}/{$yyyy}";
return $dmy;
}
echo _dmy('2012-10-25');
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment