0
votes

i have installed cakephp 1.3 which uses the following:
Apache Version :2.2.21
PHP Version : 5.3.8
MySQL Version : 5.5.16.
the Problem is when i echo the following

echo date('l jS \of F Y h:i:s A');
i get the time a few hours back than my local time( the machine time is set to my country time which australia).
when i make a change in php.ini file and set the date.timezone = UTC + 10 i get the correct local time but i also get alot of warnings.

Warning: strtotime() [function.strtotime]: 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 'Australia/Melbourne' for '10.0/no DST' instead in C:\wamp\www\cakephp\lib\Cake\Cache\Cache.php on line 515

Please help thanks

2
i checked the core.php file and found nothingTman
... i don't want to disable the warning.Tman

2 Answers

2
votes

You cannot specify timezones as offset to UTC like "UTC+10" as you mentioned in your post. You have to use one of the valid timezone strings. Pick your continent here and you will get list of valid timezone strings.

So for eg. in core.php you have to do:

date_default_timezone_set("Australia/Melbourne");

Change the timezone string to any other valid timezone string you like. By the way CakeTime::listTimezones() will also give you the list of timezones.

Edit: You can probably specify the timezone as offset to UTC but shouldn't.

1
votes

If you’re getting timezone related error from PHP uncomment one line in app/Config/core.php:

<?php
/**
 * Uncomment this line and correct your server timezone to fix
 * any date & time related errors.
 */
    date_default_timezone_set('UTC');

http://book.cakephp.org/2.0/en/installation.html#fire-it-up