This forum is in READ-ONLY mode.
You can look around, but if you want to ask a new question, please use the new forum.
Home » legacy support » symfony 1.0 » Different dates by Symfony Peer classes and MySQL
Different dates by Symfony Peer classes and MySQL [message #103305] Fri, 30 July 2010 14:44 Go to next message
gentrobot  is currently offline gentrobot
Messages: 20
Registered: October 2009
Junior Member
Hi !


Whenever I insert a new row into the database using symfony peer classes objects, symfony sets the created_at automatically. However, this date is diferent from the date output by MySQL function NOW(). So, whenever I try to insert a new raw using a raw query, there is a difference of 1 hour in the current datetime.
Re: Different dates by Symfony Peer classes and MySQL [message #103308 is a reply to message #103305 ] Fri, 30 July 2010 15:26 Go to previous messageGo to next message
halfer  is currently offline halfer
Messages: 9535
Registered: January 2006
Location: West Midlands, UK
Faithful Member
Sounds like your PHP timezone is not set correctly. A quick web search should provide you all the info you need to reset that.


Remember Palestine
Re: Different dates by Symfony Peer classes and MySQL [message #103454 is a reply to message #103308 ] Tue, 03 August 2010 09:08 Go to previous messageGo to next message
gentrobot  is currently offline gentrobot
Messages: 20
Registered: October 2009
Junior Member
I tried to check my timezone by using

<?php echo date_default_timezone_get();?>

It gave me the current timezone as 'America/Denver'. I need to set it to 'US/ARIZONA'. I want to set it using the settings.yml

I made the entry as :

.settings:
default_timezone: ['US/ARIZONA']

But it didn't work and on using "date_default_timezone_get()" it showed 'America/Denver' again. Also, I tried to set it to UTC but didn't work. I can set the timezone on the template by using date_default_timezone_set(), but I wanted it to be set from the YML so that I don't need to do that time and again

Re: Different dates by Symfony Peer classes and MySQL [message #103468 is a reply to message #103305 ] Tue, 03 August 2010 10:50 Go to previous messageGo to next message
halfer  is currently offline halfer
Messages: 9535
Registered: January 2006
Location: West Midlands, UK
Faithful Member
Do you have access to your php.ini? I would be inclined to set it there, rather than in code - since it should be the same for all systems you run from this server.


Remember Palestine
Re: Different dates by Symfony Peer classes and MySQL [message #103469 is a reply to message #103468 ] Tue, 03 August 2010 11:05 Go to previous message
gentrobot  is currently offline gentrobot
Messages: 20
Registered: October 2009
Junior Member
Hi !

Thanks Halfer ! I have set the date.timezone variable in the php.ini to 'America/Phoenix'. The issue has been resolved and things are working fine.

Thanks a lot for your help and guidance.

Topic Closed Razz
Previous Topic:some sql fields are not set.
Goto Forum:
  

powered by FUDforum - copyright ©2001-2004 FUD Forum Bulletin Board Software