mysql - SQL操作时间的函数?
巴扎黑
巴扎黑 2017-04-17 14:47:54
0
2
464

怎么从 UNIX_TIMESTAMP() 中提取月,

也就是 MONTH( FROM_UNIXTIME( 1464408176 ) ) 能简写吗?
主要是我觉得 MONTH( FROM_UNIXTIME( 1464408176 ) ) 这种用起来,肯定对服务器应能有影响,因为得得先把时间戳转成 字符串 ,然后 再从字符串计算,后提取月..

我做视图用的..

巴扎黑
巴扎黑

reply all(2)
小葫芦

FROM_UNIXTIME( 1249488000, '%m' )
FROM_UNIXTIME( 1249488000, '%y' )

Search for the rest!

刘奇

select date(FROM_UNIXTIME(字段名)) from 表名;

To extract the year, month and day, you can use MySQL’s date_format function

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!