Connecting Tech Pros Worldwide Forums | Help | Site Map

what is the meaning of this?

Chameleon
Guest
 
Posts: n/a
#1: Dec 11 '05
the code below...
-------------------------------
<?
function errorHandler($errno, $str, $file, $line)
{
//if ($errno == E_STRICT) return;
fwrite(STDERR, "\n\n$errno: $str\n\n");
if ($errno == E_USER_ERROR) die();
}
set_error_handler('errorHandler');

$a = mktime(14, 0, 0, 12, 20, 2005);
echo date('d/m/Y', $a);
?>
-------------------------------
....produces this STDERR...
-------------------------------
2048: mktime(): It is not safe to rely on the system's timezone
settings. Please use the date.timezone setting, the TZ environment
variable or the date_default_timezone_set() function. We selected
'Europe/Helsinki' for '2.0/no DST' instead


2048: date(): It is not safe to rely on the system's timezone settings.
Please use the date.timezone setting, the TZ environment variable or the
date_default_timezone_set() function. We selected 'Europe/Helsinki' for
'2.0/no DST' instead
-------------------------------
What is the meaning of this message?
How can I silence it without commenting the commented line?

Thanks

Janwillem Borleffs
Guest
 
Posts: n/a
#2: Dec 11 '05

re: what is the meaning of this?


Chameleon wrote:[color=blue]
> What is the meaning of this message?
> How can I silence it without commenting the commented line?
>[/color]

Your server could be located in America, while your application is focussed
on European users, which can produce errors with date/time related
operations.

The fix is to follow the instruction and to apply the
date_default_timezone_set() function:

date_default_timezone_set('UTC');
$a = mktime(14, 0, 0, 12, 20, 2005);
echo date('d/m/Y', $a);

Instead of UTC, you can use any of the ones listed on the following page:

http://www.php.net/manual/en/timezones.php


JW


Mara Guida
Guest
 
Posts: n/a
#3: Dec 11 '05

re: what is the meaning of this?


Chameleon wrote:[color=blue]
> the code below...
> -------------------------------
> <?
> function errorHandler($errno, $str, $file, $line)
> {
> //if ($errno == E_STRICT) return;
> fwrite(STDERR, "\n\n$errno: $str\n\n");
> if ($errno == E_USER_ERROR) die();
> }
> set_error_handler('errorHandler');
>[/color]

if (PHP_VERSION >= '5.1.0RC1')
date_default_timezone_set('Europe/Helsinki');
[color=blue]
> $a = mktime(14, 0, 0, 12, 20, 2005);
> echo date('d/m/Y', $a);
> ?>
> -------------------------------
> ...produces this STDERR...
> -------------------------------[/color]

<snip>
[color=blue]
> What is the meaning of this message?
> How can I silence it without commenting the commented line?[/color]

Closed Thread