yoda699 Posted November 24, 2009 Share Posted November 24, 2009 Hi, I am trying to convert a string to datetime format. Here is my code: SELECT STR_TO_DATE('11/02/2009 01,30,00,am','%m/%d/%Y %r') It doesn't work. Can you please tell me whats wrong with the code? Thanks Quote Link to comment https://forums.phpfreaks.com/topic/182784-help-with-str_to_date/ Share on other sites More sharing options...
Mchl Posted November 24, 2009 Share Posted November 24, 2009 SELECT STR_TO_DATE('11/02/2009 01,30,00,am','%m/%d/%Y %h,%i,%s,%p'); Quote Link to comment https://forums.phpfreaks.com/topic/182784-help-with-str_to_date/#findComment-964770 Share on other sites More sharing options...
yoda699 Posted November 24, 2009 Author Share Posted November 24, 2009 Thanks, Could you please also give me an example of how to use the %r function Quote Link to comment https://forums.phpfreaks.com/topic/182784-help-with-str_to_date/#findComment-964786 Share on other sites More sharing options...
Mchl Posted November 24, 2009 Share Posted November 24, 2009 As explained in manual %r Time, 12-hour (hh:mm:ss followed by AM or PM) Quote Link to comment https://forums.phpfreaks.com/topic/182784-help-with-str_to_date/#findComment-964797 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.