
假设如果我们想要 FROM_UNIXIME() 函数以特定格式输出,那么我们可以在其中使用日期格式字符串或时间格式字符串或两者。以下是在 FROM_UNIXTIME() 函数中使用格式字符串的示例 -
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)
在上面的查询中,它同时使用日期和时间格式字符串。
以上就是在 MySQL 中,我们如何使用带有格式字符串的 FROM_UNIXTIME() 函数?的详细内容,更多请关注php中文网其它相关文章!
每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号