Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email firstname.lastname@example.org
From: Rob Wultsch (wultschgmail.com)
Date: Wed May 14 2008 - 15:06:25 CDT
On Wed, May 14, 2008 at 12:55 PM, Ed W <listswildgooses.com> wrote:
> Rob Wultsch wrote:
>> This sounds like expected behavior to me. If you set the timezone one
>> hour forward a timestamp will be one hour forward. The data stored on
>> the server is the same, and will display the same if you change the
>> timezone. The timezone setting when the insert occurred should have no
> OK, your example is clearly demonstrating the effect I am seeing - however,
> by changing the server localtime option I appear to be influencing the
> default mysql time offset.
> I still don't understand the reality of what is happening here - your
> example appears to show that datetime fields are correctly stored as GMT and
> adjusted as desired, but that a timestamp is a function of localtime?
> Either way they appear inconsistent...
> The end result needs to be that I can get these dates out of the database
> and correctly adjust them for the desired users localtime. What you are
> demonstrating here is that I either need to ditch all my timestamp columns
> (inconvenient) or switch the server to only run in UTC (inconvenient in that
> I need to mentally adjust in order to make sense of the log files). It
> would appear that if I run the server with a correct localtime then I have a
> bag of trouble when I want to figure out the time something happened (as you
> can see c1 and c2 should be the same in all cases, but not in your example)
> Can anyone shed some light on the best approach?
> Ed W
The display of the timestamp is dependent on the local time zone.
Datetime is not adjusted for display.
I don't use timestamp because I think it is Voodoo or some other form
of black magic. I don't trust black magic that is not my own (or for
that matter anything I write involving pointers). If I want a record
to store NOW() then I tell it NOW().
For whatever it is worth I suggest ditching timestamp and going to datetime.
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql