[eluser]CI Coder[/eluser]
[quote author="Sinclair" date="1258947899"]Thanks. I'am writting a helper but I have some strange errors:
The function is this one here:
Code:
<?PHP
// $BirthDate expected format is YYYY/MM/DD
function CalculateAge($BirthDate)
{
// Put the year, month and day in separate variables
list($Year, $Month, $Day) = explode("/", $BirthDate);
$YearDiff = date("Y") - $Year;
// If the birthday hasn't arrived yet this year, the person is one year younger
if(date("m") < $Month || (date("m") == $Month && date("d") < $DayDiff))
{
$YearDiff--;
}
return $YearDiff;
}
?>
I have several errors like this:
Quote:A PHP Error was encountered
Severity: Notice
Message: Undefined offset: 2
Filename: helpers/my_calculateage_helper.php
Line Number: 6
Quote:A PHP Error was encountered
Severity: Warning
Message: date() [function.date]: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Europe/London' for '0.0/no DST' instead
Filename: helpers/my_calculateage_helper.php
Line Number: 8
The HELPER is working but display these errors... what can I do to solve this?
Best Regards,[/quote]
Go into your php.ini and set the default time zone for your PHP installation. Add a line like "date.timezone = GMT".