Timezone error : Invalid date.timezone value

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

New php-forum User
New php-forum User
Posts: 1
Joined: Sun May 12, 2013 5:44 pm

Timezone error : Invalid date.timezone value

Postby lovedigit » Sun May 12, 2013 6:05 pm


This is my first post on the website. Sorry, I din't went to the introduction section straight up. I am getting the following error on the website. The website was working fine before upgrading the php version. It would be a great help if someone could help me sort this out.

I have searched many other forum and this seems to be right place to ask for help. You guys seems to have a giant active community.

I don't have much knowledge about the php and stuff and I can't pay my developer to fix this :(

Warning: Unknown: Invalid date.timezone value 'Asia/Calcuttaextension', we selected the timezone 'UTC' for now. in Unknown on line 0

Fatal error: Uncaught exception 'Exception' with message 'DateTimeZone::__construct() expects exactly 1 parameter, 0 given' in /home/user/public_html/fw/init.php:59 Stack trace: #0 /home/user/public_html/fw/init.php(59): DateTimeZone->__construct() #1 /home/user/public_html/fw/init.php(82): fw::connect(Array) #2 /home/user/public_html/application.php(17): fw::config(Array) #3 {main} thrown in /home/user/public_html/fw/init.php on line 59

Code: Select all

# Database
        require FW.'db'.DIRECTORY_SEPARATOR.DB_ADAPTER.'.php';
        db::connect(DB_HOST, DB_USER, DB_PASS);
        # Timezone
            $date = new DateTime;
            if(method_exists($date, 'getOffset'))
                $offset = $date->getOffset()/60;
                $minutes = abs($offset);
                $hours = floor($minutes/60);
                $minutes -= $hours*60;
                db::query('SET time_zone="'.sprintf('%+d:%02d', $hours*($minutes<0?-1:1), $minutes).'"');

php-forum Super User
php-forum Super User
Posts: 1805
Joined: Thu Mar 10, 2011 5:07 pm

Re: Timezone error : Invalid date.timezone value

Postby johnj » Sun May 12, 2013 11:22 pm

What version of php are you using? In some version it is Asia/Kolkata

Return to “PHP coding => General”

Who is online

Users browsing this forum: Bing [Bot] and 5 guests