MySQL - How to parse a string value to DATETIME format inside an INSERT statement?

后端 未结 1 1486
你的背包
你的背包 2020-12-02 14:07

I have a MySQL database, with a column that is date type DATETIME.

I am getting a string value for a date / time from an external applicat

相关标签:
1条回答
  • 2020-12-02 14:44

    Use MySQL's STR_TO_DATE() function to parse the string that you're attempting to insert:

    INSERT INTO tblInquiry (fldInquiryReceivedDateTime) VALUES
      (STR_TO_DATE('5/15/2012 8:06:26 AM', '%c/%e/%Y %r'))
    
    0 讨论(0)
提交回复
热议问题