您好,欢迎访问一九零五行业门户网

mysql时间转化_MySQL

unix时间戳转换为日期用函数: from_unixtime()
select from_unixtime(1156219870);
日期转换为unix时间戳用函数: unix_timestamp()
select unix_timestamp(’2006-11-04 12:23:00′);
例:mysql查询当天的记录数:
$sql=”select * from message where date_format(from_unixtime(chattime),’%y-%m-%d’) = date_format(now(),’%y-%m-%d’) order by id desc”;
当然大家也可以选择在php中进行转换
unix时间戳转换为日期用函数: date()
date('y-m-d h:i:s', 1156219870);
日期转换为unix时间戳用函数:strtotime()
strtotime('2010-03-24 08:15:42');
其它类似信息

推荐信息