mysql日期转时间戳,时间戳转日期,取年份

默认从1970-01-01 00:00:00.000000年从0开始

select now() as '今天',UNIX_TIMESTAMP('1999-01-01 00:00:00') as '日期转时间戳',from_unixtime(UNIX_TIMESTAMP('1999-01-01 00:00:00')) as '时间戳转日期',DATE_FORMAT( from_unixtime(UNIX_TIMESTAMP('1999-01-01 00:00:00')) ,'%Y') as '取年份';

在这里插入图片描述
https://blog.csdn.net/fwj_ntu/article/details/86680053

猜你喜欢

转载自blog.csdn.net/weixin_48860638/article/details/121533528