Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

howto change MySQL time_zone

by jeanluca (Deacon)
on Sep 11, 2007 at 08:25 UTC ( #638251=perlquestion: print w/ replies, xml ) Need Help??
jeanluca has asked for the wisdom of the Perl Monks concerning the following question:

Dear Monks

My application does everything in the UTC time. Works great, however I use a field which gets the current time:
|Field | Type | Null |Key| Default |Extra | created| timestamp | YES | |CURRENT_TIMESTAMP| |
which stores time as local time (not UTC)
I tried to change the time_zone like
$dbl = DBI->connect(DBI:mysql......) ; $dbl->{'time_zone'} = "GMT" ;
(also tried UTC)
However the current timestamp is still in local time.
Currently the time_zone is set to 'SYSTEM'. I don't own the database, so I need to change the session TZ!

Any suggestions how to change this ?

Thnx a lot
LuCa

Comment on howto change MySQL time_zone
Select or Download Code
Re: howto change MySQL time_zone
by Gangabass (Priest) on Sep 11, 2007 at 09:04 UTC

    This SQL query will help you

    SET time_zone = timezone;

    See http://dev.mysql.com/doc/refman/5.0/en/time-zone-support.html for details

Re: howto change MySQL time_zone
by pajout (Curate) on Sep 11, 2007 at 09:06 UTC
    When you google "mysql time zones", the first link gives you answer - you can set up time zone in connection by
    SET time_zone = timezone;
    .
Re: howto change MySQL time_zone
by jeanluca (Deacon) on Sep 11, 2007 at 09:42 UTC
    I've seen that link before, but it didn't realy solve the problem. However, now that I've red it again, I finally understand that I need to install the time_zone table :( (without this table it is not possible to use names like 'UTC')

    Not very happy with that outcome, anyway, I think I have to go to the db-sysadmin

    Thnx a lot
    LuCa

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://638251]
Approved by Corion
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (2)
As of 2014-09-22 00:39 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (176 votes), past polls