当前位置:Gxlcms > 数据库问题 > mysql str_to_date字符串转换为日期

mysql str_to_date字符串转换为日期

时间:2021-07-01 10:21:17 帮助过:2人阅读

 


mysql> SELECT STR_TO_DATE(startDate,‘%Y年%m月%d日‘) FROM caselibrarycommon
-> WHERE STR_TO_DATE(startDate,‘%Y年%m月%d日‘) BETWEEN STR_TO_DATE(‘2015年6
‘> 月5日‘,‘%Y年%m月%d日‘) AND STR_TO_DATE(‘2015年6月20日‘,‘%Y年%m月%d日‘);
+---------------------------------------+
| STR_TO_DATE(startDate,‘%Y年%m月%d日‘) |
+---------------------------------------+
| 2015-06-16 |
| 2015-06-05 |
| 2015-06-06 |
| 2015-06-06 |
| 2015-06-06 |
| 2015-06-06 |
| 2015-06-07 |
| 2015-06-09 |
| 2015-06-08 |
| 2015-06-10 |
| 2015-06-11 |
| 2015-06-11 |
| 2015-06-11 |
| 2015-06-12 |
| 2015-06-16 |
| 2015-06-16 |
| 2015-06-17 |
| 2015-06-17 |
| 2015-06-17 |
| 2015-06-18 |
+---------------------------------------+
20 rows in set (0.00 sec)

 

select str_to_date(detectResult.`rcvDetectTime`,‘%Y-%m-%d %H:%i:%s‘) from detectResult where str_to_date(detectResult.`rcvDetectTime`,‘%Y-%m-%d %H:%i:%s‘)>=‘2010-11-22 14:49:52‘ and str_to_date(detectResult.`rcvDetectTime`,‘%Y-%m-%d %H:%i:%s‘)<=‘2010-11-22 15:27:52‘

 

给自己点个赞,么么哒(づ ̄ 3 ̄)づ

mysql str_to_date字符串转换为日期

标签:

人气教程排行