Web lists-archives.com

Re: questions about timestamps and DST

On 31/03/2015 12:20, Larry Martell wrote:
On Tue, Mar 31, 2015 at 1:13 AM, Andrew Moore <eroomydna@xxxxxxxxx> wrote:
When you use a timezone with DST there is no such thing as 2.30am on the
date of changeover. That hour doesn't exist.

I am using UCT - I am not using a timezone.

In MySQL 5 and above, TIMESTAMP values are converted from the local server time to UTC at storage and then back again at select. So if the local server is using a DST timezone, then your TIMESTAMP value will always reflect local DST.

Look up the difference between timestamp and datetime data types.

I did do that before I posted, but it wasn't really clear to me, but I
think I need to use a DATETIME instead of a TIMESTAMP. Correct?


As a highly-rated comment on StackOverflow puts it:

"Timestamps in MySQL generally used to track changes to records, and are often updated every time the record is changed. If you want to store a specific value you should use a datetime field."


As a more general rule of thumb, use DATETIME unless you have a specific application for which you know that TIMESTAMP is more appropriate. They're not interchangeable, and not intended to be.


MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/mysql