【问题标题】:Convert MySQL string into Time将 MySQL 字符串转换为时间
【发布时间】:2018-08-01 14:51:57
【问题描述】:

我有一列存储为例如 0545(上午 5:45)的时间和存储为 20180801 的日期列。我想将它们组合成一个值 2018/08/01 05:45 am)我如果这有所不同,我将通过 ODBC 连接执行此操作。我可以在日期列上使用 STR_TO_DATE 但我无法确定时间列。谢谢。

【问题讨论】:

    标签: mysql date time


    【解决方案1】:

    在整个事情上使用str_to_date()

    select str_to_date(concat(datecol, timecol), '%Y%m%d%h%i')
    

    【讨论】:

      猜你喜欢
      • 2020-08-29
      • 2019-04-02
      • 1970-01-01
      • 1970-01-01
      • 2016-06-13
      • 1970-01-01
      • 1970-01-01
      • 2012-02-03
      相关资源
      最近更新 更多