If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > How do I change Mysql timezone ?

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 10-26-04, 01:06
rexselin rexselin is offline
Registered User
 
Join Date: Aug 2003
Location: India
Posts: 109
How do I change Mysql timezone ?

Hi all,

I 've got a database in which the timestamp is stored as
the number of seconds elapsed from 1970-01-01 00:00:00 GMT


a sample data would look like

TABLE
--------------
slot
0 --> 1970-01-01 00:00:00
3600 --> 1970-01-01 01:00:00
7200 --> 1970-01-01 02:00:00
10800 --> 1970-01-01 03:00:00
14400 --> 1970-01-01 04:00:00


(Note : the right part is not stored in the database .. I have added it
so that we know what datetime a slot should return at any point).

And now I have a form through which I get a datetime from the user and then
return the corresponding slot to him/her.For this , I use a unix_timestamp()
function that will convert a datetime to seconds and get the required result.

But when I query mysql with this command in a windows machine (mysql version 4.0.18)

SELECT unix_timestamp( '1970-01-01 04:00:00' )
I get "0" as result.

where as in a Linux machine (mysql version 3.23.54)
I get "-5400"


Then I found out that my mysql system variable "timezone" follows "India
Standard Time"... Now how do I determine my CURRENT SERVER TIMEZONE and
change my unix_timestamp function so that it always returns the correct slot to me?

Thanks in advance.
Regards,
Celia.A
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On