[56K WARN] help with: Notice: Undefined offset: 2 in ...
Posted: Wed Nov 07, 2007 6:09 am
Hi there. how are you guys? I have some small trouble with a piece of php code, and as I am just learning php, I cant solve it by myself :/
this Notice is shown when I hide all events on my page:
when I have events (someone create an event), then it looks like this:

but when I hide this event (in my admin panel), then it will do this:

here is the part of code where the notice is pointing:
line 3744 is this:
i think that there's problem with dates, but I dont know where... or what is wrong
thanks for all ideas... thanks a lot...
this Notice is shown when I hide all events on my page:
Code: Select all
valid since:
Notice: Undefined offset: 2 in E:\www\balfornet\resources\functions.php on line 3744
Notice: Undefined offset: 1 in E:\www\balfornet\resources\functions.php on line 3744
00.00.0000 till:
Notice: Undefined offset: 2 in E:\www\balfornet\resources\functions.php on line 3744
Notice: Undefined offset: 1 in E:\www\balfornet\resources\functions.php on line 3744
00.00.0000but when I hide this event (in my admin panel), then it will do this:
here is the part of code where the notice is pointing:
Code: Select all
<?
/**
* @desc format date for MySQL
* @param string
* @return string
*/
function formatDateToMySQL($dateString, $short=false) {
//if ( validDateFormat($dateString) ) {
$dateArr = split('[-,/,.]', $dateString);
if ($short == true) {
return sprintf("%04d-%02d", $dateArr[1] , $dateArr[0]);
} else {
return sprintf("%04d-%02d-%02d", $dateArr[2] , $dateArr[1] , $dateArr[0]);
}
//} else {
// return $dateString;
//}
}
/**
* @desc format date for UK display
* @param string
* @return string
*/
function formatDateToUK($dateString, $short=false) {
//if ( validDateFormat($dateString) ) {
$dateArr = split('[-,/,.]', $dateString);
if ($short == true) {
return sprintf("%02d/%04d", $dateArr[1] , $dateArr[0]);
} else {
return sprintf("%02d/%02d/%04d", $dateArr[2] , $dateArr[1] , $dateArr[0]);
}
//} else {
// return $dateString;
//}
}
?>Code: Select all
return sprintf("%02d/%02d/%04d", $dateArr[2] , $dateArr[1] , $dateArr[0]);thanks for all ideas... thanks a lot...