FROM_UNIXTIME(unix_timestamp[,format])

Description: Returns the date and time of unix_timestamp, which specifies the number of seconds since 1 January 1970 at 00:00:00 GMT. Formatting options are the same as for DATE_FORMAT() and are as shown previously in Table C.2.

Examples:

  • FROM_UNIXTIME(1000000000) returns 2001-09-09 01:46:40.

  • FROM_UNIXTIME(1000000000)+0 returns 20010909014640.

  • FROM_UNIXTIME(1000000000,'%W at %r') returns Sunday at 01:46:40 AM.

See also: NOW(), UNIX_TIMESTAMP()

Get Sams Teach Yourself MySQL in 21 Days, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.