หากต้องการผลลัพธ์ของ FROM_UNIXTIME() ในรูปแบบเฉพาะ สามารถใช้สตริงรูปแบบวันที่ (date format string) หรือเวลา (time format string) หรือทั้งคู่ ตัวอย่างการใช้งาน:
mysql> SELECT FROM_UNIXTIME(1555033470, '%Y %M %D') AS 'Formatted Output'; +------------------+ | Formatted Output | +------------------+ | 2019 April 12th | +------------------+ 1 row in set (0.00 sec)
คำสั่งด้านบนใช้เฉพาะสตริงรูปแบบวันที่
mysql> SELECT FROM_UNIXTIME(1555033470, '%h:%i:%s') AS 'Formatted Output'; +------------------+ | Formatted Output | +------------------+ | 07:14:30 | +------------------+ 1 row in set (0.00 sec)
คำสั่งด้านบนใช้เฉพาะสตริงรูปแบบเวลา
mysql> SELECT FROM_UNIXTIME(1555033470, '%Y %M %D %h:%i:%s') AS 'Formatted Output'; +--------------------------+ | Formatted Output | +--------------------------+ | 2019 April 12th 07:14:30 | +--------------------------+ 1 row in set (0.00 sec)
คำสั่งด้านบนใช้ทั้งสตริงรูปแบบวันที่และเวลา