数据库时间节点 vertica mysql db2

    科技2022-07-10  134

    –时间节点–vertica数据库 select quarter(‘today’);–当前所属的季度 select now();–当前的时间戳 select date_part(‘doy’,sysdate)–当前在年里第几天 select date_part(‘dow’,sysdate)–当周的第几天 select date_part(‘month’,sysdate)–当前的月份 select hour(sysdate)–当前的小时 select minute(sysdate)–当前的分钟 select last_day(‘now’)–当月的最后一天 select week(‘now’)–在本年中的周次 select date(‘now’)–今天 select date(‘yesterday’)–昨天 select date(‘tomorrow’)–明天 select trunc(sysdate,‘Q’)–本季初 select add_months(trunc(sysdate,‘Q’),3)-1–本季末 select trunc(sysdate,‘yyyy’)–年初 select add_months(trunc(sysdate,‘yyyy’),12)-1–年末 –时间节点–vertica数据库 –时间节点–mysql数据库 select quarter(now());–当前所属的季度 select now();–当前的时间戳 select dayofyear(now())–当前在年里第几天 select dayofweek(now())–当周的第几天 select dayofmonth(now())–当前的月份 select hour(now())–当前的小时 select minute(now())–当前的分钟 select last_day(now())–当月的最后一天 select last_day(now())–当月的最后一天 select week(now())–在本年中的周次 select date(now())–今天 select date_sub(curdate(),INTERVAL WEEKDAY(curdate())+1 DAY)–本周的第一天(周日) select date_sub(curdate(),INTERVAL WEEKDAY(curdate())-5 DAY)–本周的第最后一天(周六) select last_day(now() - interval 1 month)–上月末 select (last_day(now() - interval 1 month)+ interval 1 day)–本月月初 select date(now() - interval 1 day)–昨天 select date(now() + interval 1 day)–明天 select CONCAT(date_format(now(),’%Y’),‘0’,(quarter(now())*3)-2,‘01’)–本季初 select LAST_DAY(CONCAT(date_format(now(),’%Y’),‘0’,(quarter(now())*3),‘01’))–本季末 select concat(date_format(now(),’%Y’),‘0101’)–年初 select concat(date_format(now(),’%Y’),‘1231’)–年末 –时间节点–mysql数据库 --时间节点–DB数据库 values (current date);–当前的时间 values (current date) - 1 day;–昨天 values (current date)+ 1 day;–明天 values year(current date);–当前年 values day(current date);–当前日 values month(current date);–当前月 values quarter(current date)–当前季 values date(year(current date)||’-0’||((quarter(current date)*3) - 2) ||’-01’);–当前季初 values last_day(date((year(current date)||’-0’||(quarter(current date)*3)||’-01’)));–当前季末 values week(current date);–当前周次 values dayofweek(current date);–当前周几 values last_day(current date);–本月末 values (last_day(current date - 1 month) + 1 day);–本月初 values date(year(current date)||’-01-01’)–年初 values date(year(current date)||’-12-31’)–年末 –时间节点–DB数据库

    Processed: 0.012, SQL: 8