Results 1 to 4 of 4
  1. #1
    Join Date
    Apr 2003
    Posts
    134

    Unanswered: Convert Text to datetime

    Hi,

    I have below date text and I want to know how can I convert it to valid MySQL datetime which is yyyy-mm-dd HH:mm

    Nov 20 2015 10:51AM
    Nov 20 2015 10:16PM
    Nov 20 2015 10:01AM
    Nov 20 2015 8:43PM
    Nov 20 2015 8:04PM
    Nov 20 2015 5:49PM
    Nov 20 2015 5:38PM
    Nov 20 2015 5:23PM
    Nov 20 2015 5:03PM
    Nov 20 2015 4:57PM
    Nov 20 2015 2:10PM
    Nov 20 2015 1:51PM
    Nov 19 2015 12:24AM
    Nov 19 2015 11:56AM
    Nov 19 2015 11:32PM
    Nov 19 2015 11:27PM
    Nov 19 2015 10:15AM
    Nov 19 2015 10:12PM


    How can I do this please?


    Thanks,
    Jassim

  2. #2
    Join Date
    Oct 2009
    Posts
    67
    All that can be answered with MySQL's documentation:
    http://dev.mysql.com/doc/refman/5.7/...functions.html

  3. #3
    Join Date
    Apr 2003
    Posts
    134
    Quote Originally Posted by LAYGO View Post
    All that can be answered with MySQL's documentation:
    http://dev.mysql.com/doc/refman/5.7/...functions.html
    I tried this:

    DATE("H:i:s", SUBSTRING(order_time, 13, 7)) AS order_hour

    but getting:

    [Err] 1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'FROM from_talabat' at line 9

  4. #4
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    Provided Answers: 54
    Start with http://sqlfiddle.com/#!9/2670e1/1 and ask specific questions. Post the new Fiddle URL if you make changes so that we can work from the same code/schema/data that you are using.

    -PatP
    In theory, theory and practice are identical. In practice, theory and practice are unrelated.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •