mysql语句中把string类型字段转datetime类型
 
在mysql里面利用str_to_date()把字符串转换为日期
 
此处以表h_hotelcontext的Start_time和End_time字段为例,查询当前
时间在此范围之内的数据。  www.2cto.com  
 
select * from h_hotelcontext where now() between STR_TO_DATE
(Start_time,'%Y-%m-%d %H:%i:%s') and STR_TO_DATE(End_time,'%Y-%m-%d %H:%i:%s'); 
 
注:'%Y-%m-%d %H:%i:%s'格式为:2012-10-11 16:42:30

相关文章:

  • 2021-05-20
  • 2022-01-18
  • 2021-11-15
  • 2022-12-23
  • 2021-07-09
  • 2022-12-23
  • 2021-11-11
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案