GopherDesign
12-04-2008, 10:36 PM
PHP Problem with date and mktime -- almost got it
I am still looking and have found alot about it.
I know my mktime was malformed, but I am not sure what changed from one server to another. Not sure if it was the php version or perhaps the clock or something.
it did do:
date("h:i A", mktime($rs['EventBeginTime']{8} . $rs['EventBeginTime']{9}, $rs['EventBeginTime']{10} . $rs['EventBeginTime']{11}))
I got it working doing:
$hour = substr($rs['EventBeginTime'], 11, 2);
$minute = substr($rs['EventBeginTime'], 14, 2);
$second = substr($rs['EventBeginTime'], 17, 2);
$month = substr($rs['EventBeginTime'], 5, 2);
$day = substr($rs['EventBeginTime'], 8, 2);
$year = substr($rs['EventBeginTime'], 0, 4);
$StartTime = $rs['EventBeginTime'];
$fstrtim = date("h:i A",mktime ($hour,$minute,$second,$month,$day,$year));
I can now call $fstrtim and it works, but I would like to know what changed. I wonder if it is something simple becuase I do not want to have to change the code on every page.
__________________
AIM: GopherDesign
ICQ: 39 401 865
WWW: http://www.gopherdesign.com
WWW: http://www.gopherwebhosting.com
I am still looking and have found alot about it.
I know my mktime was malformed, but I am not sure what changed from one server to another. Not sure if it was the php version or perhaps the clock or something.
it did do:
date("h:i A", mktime($rs['EventBeginTime']{8} . $rs['EventBeginTime']{9}, $rs['EventBeginTime']{10} . $rs['EventBeginTime']{11}))
I got it working doing:
$hour = substr($rs['EventBeginTime'], 11, 2);
$minute = substr($rs['EventBeginTime'], 14, 2);
$second = substr($rs['EventBeginTime'], 17, 2);
$month = substr($rs['EventBeginTime'], 5, 2);
$day = substr($rs['EventBeginTime'], 8, 2);
$year = substr($rs['EventBeginTime'], 0, 4);
$StartTime = $rs['EventBeginTime'];
$fstrtim = date("h:i A",mktime ($hour,$minute,$second,$month,$day,$year));
I can now call $fstrtim and it works, but I would like to know what changed. I wonder if it is something simple becuase I do not want to have to change the code on every page.
__________________
AIM: GopherDesign
ICQ: 39 401 865
WWW: http://www.gopherdesign.com
WWW: http://www.gopherwebhosting.com
