• SAP HANA的常用函数(时间类函数)



    SELECT ADD_DAYS(TO_DATE('2015-10-20','YYYY-MM-DD'),30) "add days" FROM DUMMY;
    SELECT ADD_MONTHS(TO_DATE('2015-10-20','YYYY-MM-DD'),1) "add months" FROM DUMMY;
    SELECT ADD_SECONDS(TO_TIMESTAMP('2015-10-21 23:30:45'),60*30) "add seconds" FROM DUMMY;
    SELECT ADD_YEARS(TO_DATE('2009-12-05','YYYY-MM-DD'), 1) "add years" FROM DUMMY;
    SELECT CURRENT_DATE "current date" FROM DUMMY;
    SELECT CURRENT_TIMESTAMP "current timestamp" FROM DUMMY;
    SELECT DAYNAME('2015-10-20') "dayname" FROM DUMMY;
    SELECT DAYOFMONTH('2011-05-30') "dayofmonth" FROM DUMMY;
    SELECT DAYOFYEAR('2011-05-30') "dayofyear" FROM DUMMY;
    SELECT DAYS_BETWEEN(TO_DATE('2009-12-05','YYYY-MM-DD'), TO_DATE('2010-01-05', 'YYYY-MM-DD')) "days between" FROM DUMMY;
    SELECT EXTRACT (YEAR FROM TO_DATE ('2010-01-04', 'YYYY-MM-DD')) "extract" FROM DUMMY;
    SELECT HOUR ('2010-01-04 12:34:56') "hour" FROM DUMMY;
    SELECT ISOWEEK(TO_DATE('2011-05-30','YYYY-MM-DD')) "isoweek" FROM DUMMY;
    SELECT LAST_DAY (TO_DATE('2010-01-04', 'YYYY-MM-DD')) "last day" FROM DUMMY;
    SELECT MINUTE ('2010-01-04 12:34:56') "minute" FROM DUMMY;
    SELECT MONTH ('2011-05-30') "month" FROM DUMMY;
    SELECT MONTHNAME ('2011-10-30') "monthname" FROM DUMMY;
    SELECT NEXT_DAY (TO_DATE ('2009-12-31', 'YYYY-MM-DD')) "next day" FROM DUMMY;
    SELECT NOW() "now" FROM DUMMY;
    SELECT QUARTER (TO_DATE('2015-04-01', 'YYYY-MM-DD'), 4) "quarter" FROM DUMMY;
    SELECT SECOND ('2015-04-01 12:34:56') "second" FROM DUMMY;
    SELECT SECONDS_BETWEEN ('2009-12-31', '2010-01-01') "seconds between" FROM DUMMY;
    SELECT WEEK (TO_DATE('2011-05-30', 'YYYY-MM-DD')) "week" FROM DUMMY;
    SELECT WEEKDAY (TO_DATE ('2015-10-20', 'YYYY-MM-DD')) "week day" FROM DUMMY;
    SELECT YEAR (TO_DATE ('2011-05-30', 'YYYY-MM-DD')) "year" FROM DUMMY;

  • 相关阅读:
    51.try块和catch块中return语句的执行
    17. 处理日期
    16.查找特定字符出现的次数
    15.字符串长度
    14.字符串拆分
    13.字符串比较
    12.幸运抽奖
    11.使用枚举
    10.获取系统时间
    MSSQL 判断临时表是否存在
  • 原文地址:https://www.cnblogs.com/csjoz/p/16104968.html
Copyright © 2020-2023  润新知