将字段存储时间设置为varchar EX:06:30 AM
。我需要从此字段中选择一个查询并转换为数字6.30
。
答案 0 :(得分:0)
使用date
转换字符串echo date('g.i',strtotime('06:30 AM'));
输出6.30
g => 12-hour format of an hour without leading zeros 1 through 12
i => Minutes with leading zeros 00 to 59
答案 1 :(得分:0)
将<{1}}用于此
TIME_FORMAT()
修改强>
SELECT TIME_FORMAT( column_name, '%H.%i' ) AS time from table_name;