mysql 查询直接在查询语句中转换日期格式
DATE_FORMAT(FROM_UNIXTIME(chattime),’%Y-%m-%d’)
例子:
SELECT DATE_FORMAT(FROM_UNIXTIME(s_time),’%Y-%m-%d’) FROM sdb_scarebuying_scare_buying;
SELECT a.goods_id,b.name,b.price,DATE_FORMAT(FROM_UNIXTIME(a.s_time),’%Y-%m-%d’) AS start_time,DATE_FORMAT(FROM_UNIXTIME(a.e_time),’%Y-%m-%d’) AS end_time,a.scare_count,a.scare_price,a.scare_mprice,a.buycountlimit,a.goodscore
FROM sdb_scarebuying_scare_buying a LEFT JOIN sdb_goods b ON a.goods_id=b.goods_id;
ps:如果您感觉此文对您有帮助,请帮忙点击文章右侧的广告位支持一下博主。
转载请注明:苏demo的别样人生 » mysql 查询直接在查询语句中转换日期格式