【问题标题】:Replacing now () with current date and custom time用当前日期和自定义时间替换 now ()
【发布时间】:2021-07-28 15:15:42
【问题描述】:

我想将 now() 替换为当前日期和自定义时间,例如: 2021 年 7 月 28 日上午 8:00

(select count(*) from students where exams.id=students.exam_id and students.exam_id=exams.id 
and end_time <> ''and bb_user_id is not null and test_status<>1 and
review_end is null and (exam_end + interval 2 day) > now() and exam_end < now()) as current

【问题讨论】:

    标签: mysql sql metabase


    【解决方案1】:

    您可以使用addtime() 设置当前日期的时间:

    select addtime(cast(current_date as datetime), time('08:00:00'))
    

    注意第一个参数必须是datetime,所以addtime(current_date, time('08:00:00'))

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-09-18
      • 2019-11-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多