Last active
December 16, 2015 12:19
-
-
Save djekl/5433675 to your computer and use it in GitHub Desktop.
convert UK date to US date
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* private uk2usa() | |
* @param string $timestamp UK Date Format (d/m/Y) | |
* @return string American Date Format (Y-m-d) | |
*/ | |
private function uk2usa($timestamp = FALSE) | |
{ | |
if( ! $timestamp) | |
return date('Y-m-d'); | |
list($day, $month, $year) = explode('/', $timestamp); | |
return $year . '-' . $month . '-' . $day; | |
} | |
// ------------------------------------------------------------------------ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment