Magiccupcake
09 Jan 2008, 04:43 PM
I am having problems with a php calendar that reads from a mysql database. The site has been transfered from a different server and now does not seem to work properly. i get the error message.
Warning: date(): Windows does not support dates prior to midnight (00:00:00), January 1, 1970 in C:\Inetpub\vhosts\saukvalleyareachamber.com\httpdocs\calendar\includes\functions.php on line 23
This is the code that seems to be the problem.
<!-- Functions.php -->
<?php
function fixdate($month,$day,$year)
{
$dateToFix="$year-$month-$day";
$unixTime=mktime($dateToFix);
$fixedDate=date("Y-m-d",$unixTime);
return $fixedDate;
}
function fixtime($hour,$minute,$second,$ap)
{
$time="$hour$minute$ap";
if ($time=="120AM")
{$fixedTime="12:00:00 AM"; return $fixedTime;}
elseif($time=="120PM")
{$fixedTime="12:00:00 PM"; return $fixedTime;}
else{
if ($ap=="PM"){$hour=$hour+12;}
$timeToFix="$hour:$minute:$second";
$unixTime=strtotime($timeToFix);
$fixedTime=date("h:i:s A",$unixTime);
return $fixedTime;
}
}
line 23 is
$fixedDate=date("Y-m-d",$unixTime);
Can anyone tell me what might be the problem?
Warning: date(): Windows does not support dates prior to midnight (00:00:00), January 1, 1970 in C:\Inetpub\vhosts\saukvalleyareachamber.com\httpdocs\calendar\includes\functions.php on line 23
This is the code that seems to be the problem.
<!-- Functions.php -->
<?php
function fixdate($month,$day,$year)
{
$dateToFix="$year-$month-$day";
$unixTime=mktime($dateToFix);
$fixedDate=date("Y-m-d",$unixTime);
return $fixedDate;
}
function fixtime($hour,$minute,$second,$ap)
{
$time="$hour$minute$ap";
if ($time=="120AM")
{$fixedTime="12:00:00 AM"; return $fixedTime;}
elseif($time=="120PM")
{$fixedTime="12:00:00 PM"; return $fixedTime;}
else{
if ($ap=="PM"){$hour=$hour+12;}
$timeToFix="$hour:$minute:$second";
$unixTime=strtotime($timeToFix);
$fixedTime=date("h:i:s A",$unixTime);
return $fixedTime;
}
}
line 23 is
$fixedDate=date("Y-m-d",$unixTime);
Can anyone tell me what might be the problem?