• MySQL获取当前日期时间前几天0点


    MySQL获取当前日期时间前几天0点   我超怕的- https://www.cnblogs.com/iAmSoScArEd/p/13614058.html

    1、获取当前日期的00点

    select timestamp(date_add(curdate(), interval - 0 day));

    +--------------------------------------------------+
    | timestamp(date_add(curdate(), interval - 0 day)) |
    +--------------------------------------------------+
    | 2020-09-04 00:00:00                           |
    +--------------------------------------------------+

    2、获取当前时间的后一天(明天) 00点

    select timestamp(date_add(curdate(), interval + 1 day));

    +--------------------------------------------------+
    | timestamp(date_add(curdate(), interval + 1 day)) |
    +--------------------------------------------------+
    | 2020-09-05 00:00:00                          |
    +--------------------------------------------------+

    3、获取当前日期时间的前一天(昨天)00点

    select timestamp(date_add(curdate(), interval - 1 day));

    +--------------------------------------------------+
    | timestamp(date_add(curdate(), interval - 1 day)) |
    +--------------------------------------------------+
    | 2020-09-03 00:00:00                            |
    +--------------------------------------------------+

    4、获取本月1号的00点

    select timestamp(date_add(curdate(), interval - day(curdate()) + 1 day));
  • 相关阅读:
    [SoapUI] EndPoint不需要在配置文件中设置不同环境的值,SoapUI自带此参数的设置
    [Training Video
    [Training Video
    [Training Video
    [Training Video
    [Training Video
    [Training Video
    [Training Video
    [Training Video
    [Training Video
  • 原文地址:https://www.cnblogs.com/iAmSoScArEd/p/13614058.html
Copyright © 2020-2023  润新知