madmatter23
09-23-2007, 03:39 AM
Alright. I'm attempting to do something very simple, but I can't seem to figure out where the problem lies.
My users submit the date in format mm/dd/yyy via post, and I then want to display in a particular format using the date() and mktime() functions.
//format class dates
$classdate[0] = $_POST['classyear'];
$classdate[1] = $_POST['classmonth'];
$classdate[2] = $_POST['classday'];
$classdate = implode("-",$classdate);
$classdateDisplay= date('F d, Y', mktime(0,0,0,$classdate[1],$classdate[2],$classdate[0]));
echo "debug: \$classdate = $classdate<br />";
echo "debug: \$classdateDisplay = $classdateDisplay<br />";
When I enter the values 2008/01/01 in the form, $classdate then correctly is displayed as 2008-01-01.
But when I echo $classdateDisplay, it displays "December 3, 2001."
I'm following the formatting as described http://us.php.net/mktime (here), which is:
int mktime ( [int $hour [, int $minute [, int $second [, int $month [, int $day [, int $year [, int $is_dst]]]]]]] )
What am I missing here?
Thanks in advance.
My users submit the date in format mm/dd/yyy via post, and I then want to display in a particular format using the date() and mktime() functions.
//format class dates
$classdate[0] = $_POST['classyear'];
$classdate[1] = $_POST['classmonth'];
$classdate[2] = $_POST['classday'];
$classdate = implode("-",$classdate);
$classdateDisplay= date('F d, Y', mktime(0,0,0,$classdate[1],$classdate[2],$classdate[0]));
echo "debug: \$classdate = $classdate<br />";
echo "debug: \$classdateDisplay = $classdateDisplay<br />";
When I enter the values 2008/01/01 in the form, $classdate then correctly is displayed as 2008-01-01.
But when I echo $classdateDisplay, it displays "December 3, 2001."
I'm following the formatting as described http://us.php.net/mktime (here), which is:
int mktime ( [int $hour [, int $minute [, int $second [, int $month [, int $day [, int $year [, int $is_dst]]]]]]] )
What am I missing here?
Thanks in advance.