I want to convert the string "2017-03-13T14:39:00.000"
into datetime format in my sql select query.
After converting it, I have to compare this with another date. So I'm expecting the converted datetime should be compatible with comparison operators (< and >).
Thanks
You might want to look at the STR_TO_DATE() function of mysql.
Example (added)
SELECT STR_TO_DATE('2017-03-13T14:39:01.123','%Y-%m-%dT%H:%i:%s.%f');
This is my result
+---------------------------------------------------------------+
| STR_TO_DATE('2017-03-13T14:39:01.123','%Y-%m-%dT%H:%i:%s.%f') |
+---------------------------------------------------------------+
| 2017-03-13 14:39:01.123000 |
+---------------------------------------------------------------+
1 row in set (0,00 sec)
mysql>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With