0

I store lot of my application timestamps in MySQL DB and one weird thing I am observing is when I store day end time say 2014-10-29 23:59:59.999 and when I check the same in the db table it rounds the timestamp to next second and shows 2014-10-30 00:00:00.000 is there anything wrong I am doing here or is it an issue with MySQL.I am storing all the timestamps in UTC.

-Regards, WillSteel

willsteel
  • 1,037
  • 2
  • 12
  • 21
  • possible duplicate of [Timestamp with a millisecond precision: How to save them in MySQL](http://stackoverflow.com/questions/26299149/timestamp-with-a-millisecond-precision-how-to-save-them-in-mysql) – Gord Thompson Nov 27 '14 at 09:31

1 Answers1

0

Up until MySQL 5.6.4 fractional seconds are discarded. See http://dev.mysql.com/doc/refman/5.6/en/datetime.html

A DATETIME or TIMESTAMP value can include a trailing fractional seconds part in up to microseconds (6 digits) precision. In particular, as of MySQL 5.6.4, any fractional part in a value inserted into a DATETIME or TIMESTAMP column is stored rather than discarded.

Vlad
  • 10,602
  • 2
  • 36
  • 38
  • here the fractional seconds are not being discarded instead an extra second is being added and the time is changing from 23.59.59.000 to 00.00.00.000 wondering what might be the reason behind this. – willsteel Nov 28 '14 at 12:08