JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
made date conversion programs default to the current year (not 2000)
authorJason Woofenden <jason183@herkamire.com>
Fri, 12 Oct 2007 09:35:26 +0000 (05:35 -0400)
committerJason Woofenden <jason183@herkamire.com>
Fri, 12 Oct 2007 09:35:26 +0000 (05:35 -0400)
time.php

index 81f4048..a3bc761 100644 (file)
--- 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;