1.to_timestamp:
AND to_timestamp(a.upload_time,'yyyy-MM-dd')>='"+startTime+"' and to_timestamp(a.upload_time,'yyyy-MM-dd') <= '"+endTime+"'
2.substring:
substring('2019-04-08 14:18:09',index,k):
数值代表含义 index:代表从index开始截取数据,k代表从index开始截取到第k个数据
处理对象:时间为字符串格式的数据
eg:
截取时间到 年-月-日:
SELECT substring(upload_time,1,10) from table WHERE upload_time='2019-04-08 14:18:09'
结果:2019-04-08
截取时间到 时:分:
SELECT substring(upload_time,12,5) from table WHERE upload_time='2019-04-08 14:18:09'
结果:14:18