In multi-tier systems, where the only place where you you have a concept of "localtime" is many tiers away from the database. Therefore, I'm not a fan of the mysql column type of timestamp
, because it means that data returned is dependent on the configuration of the server and the connection of the client. I would much rather use datetime
columns and be explicit about timezones.
Since mysql 5.6.5, there is support for defaults, but it appears that the only default for datetime
columns is CURRENT_TIMESTAMP
, which sets a datetime
column to the local time.
Is there anyway, other than triggers, to have a datetime
creation column, which stores the creation time in UTC?