From: Jason Woofenden Date: Fri, 12 Oct 2007 09:35:26 +0000 (-0400) Subject: made date conversion programs default to the current year (not 2000) X-Git-Url: https://jasonwoof.com/gitweb/?p=wfpl.git;a=commitdiff_plain;h=4eb7802495423bf2fac8999652a5a24aa4626770 made date conversion programs default to the current year (not 2000) --- diff --git a/time.php b/time.php index 81f4048..a3bc761 100644 --- a/time.php +++ b/time.php @@ -81,7 +81,11 @@ function mdy_to_ymd($date) { switch(count($parts)) { case 1: $year = $parts[0]; - list($month, $day) = explode('/', date('m/d')); + if(strlen($year) == 0) { + list($month, $day, $year) = explode('/', date('m/d/Y')); + } else { + list($month, $day) = explode('/', date('m/d')); + } break; case 2: list($month, $year) = $parts; @@ -104,7 +108,11 @@ function ymd_to_mdy($date) { switch(count($parts)) { case 1: $year = $parts[0]; - list($month, $day) = explode('-', date('m-d')); + if(strlen($year) == 0) { + list($year, $month, $day) = explode('-', date('Y-m-d')); + } else { + list($month, $day) = explode('-', date('m-d')); + } break; case 2: list($year, $month) = $parts;