[snip] datetime is "displayed" as YYYY-MM-DD HH:MM:SS - it is *not* stored that way. It is stored as a *nix timestamp - an integer number of seconds since 1970-01-01 00:00:00. [/snip]
Actually datetime is not stored as epoch time. It has a range from 1000-01-01 00:00:00 to 9999-12-31 23:59:59 because it is a combination of a date and a time field as Neculai wrote. You may be thinking of a timestamp, which is tored as a 4 byte int. --- Tom Crimmins Interface Specialist Pottawattamie County, Iowa -----Original Message----- From: Frank Bax [mailto:[EMAIL PROTECTED] Sent: Saturday, January 08, 2005 9:04 AM To: mysql@lists.mysql.com Subject: Re: Why DATETIME takes 8 bytes? At 06:00 AM 1/8/05, Ehud Shapira wrote: >I don't understand why DATETIME takes 8 bytes. It's just a waste, >since >DATE+TIME take 6 bytes. And in fact, while DATE and TIME are each >DATE+rounded >up to bytes on its own, a combined DATETIME should only take 5 bytes: > >14 bits for year >04 bits for month >05 bits for day >05 bits for hour >06 bits for minutes >06 bits for seconds >--- >40 bits datetime is "displayed" as YYYY-MM-DD HH:MM:SS - it is *not* stored that way. It is stored as a *nix timestamp - an integer number of seconds since 1970-01-01 00:00:00. A 4-byte integer field has historically been used on *nix systems for this purpose, but this has an upper limit of 2038. A larger *nix timestamp is now used to avoid the equivalent of Y2K in 2038. The 8-byte *nix timestamp accommodates micro-seconds. -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]