Petruza Petruza -3 years ago 212
MySQL Question

MySQL: how to get an actual TimeStamp? literally the amount of seconds since 1970-01-01 UTC

A MySQL timestamp field is written and read as 'yyyy-MM-dd hh:mm:ss', how can I get the actual amount of seconds since 1970-01-01 UTC?

Answer Source


If called with no argument, returns a Unix timestamp (seconds since '1970-01-01 00:00:00' UTC) as an unsigned integer. If UNIX_TIMESTAMP() is called with a date argument, it returns the value of the argument as seconds since '1970-01-01 00:00:00' UTC. date may be a DATE string, a DATETIME string, a TIMESTAMP, or a number in the format YYMMDD or YYYYMMDD.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download