How does MySQL store timestamps internally?

How does MySQL store timestamps internally? Is it an int, or a string or something else?

13.10.2009 23:37:16
4 ОТВЕТА
РЕШЕНИЕ

From the MySQL Documentation:

TIMESTAMP: A four-byte integer representing seconds UTC since the epoch ('1970-01-01 00:00:00' UTC)

15
13.10.2009 23:43:48

I believe it uses a UNIX timestamp, which is an integer representing the number of seconds since the UNIX epoch: Jan 01 1970

1
13.10.2009 23:40:25
2
13.10.2009 23:41:18

All Date, Time, Datetime, Timestamp are stored as Integers internally but Different Datatypes has Different Integers Values Like

YEAR: A one-byte integer

DATE: A three-byte integer packed as YYYY×16×32 + MM×32 + DD

TIME: A three-byte integer packed as DD×24×3600 + HH×3600 + MM×60 + SS

TIMESTAMP: A four-byte integer representing seconds UTC since the epoch ('1970-01-01 00:00:00' UTC)

DATETIME: Eight bytes: A four-byte integer for date packed as YYYY×10000 + MM×100 + DD and a four-byte integer for time packed as HH×10000 + MM×100 + SS

Reference: Data Time Explanatory MySQL Documentation

1
16.05.2017 10:07:23