博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Teradata 时间函数
阅读量:4209 次
发布时间:2019-05-26

本文共 930 字,大约阅读时间需要 3 分钟。

时间差异(月):select (date '2003-08-15' - date '2003-01-01') month;
时间差异(天):select date '2003-08-15' - date '2003-01-01';
[@more@]
时间差异(秒):select ((time02 / 10000) * 3600 + (time02 / 100 MOD 100) * 60 + (time02 MOD 100)) -
((time01 / 10000) * 3600 + (time01 / 100 MOD 100) * 60 + (time01 MOD 100)) as time_diff
月份操作:select add_months(current_date, 3); 
ADD_MONTHS(Date, -2) 
add_months(date '2002-01-31', 1);
本月第一天:select date - extract(day from date) + 1
上月最后一天:select date '2008-03-03' - extract(day from '2008-03-03')
decemal转成time:select cast(cast(cast(TimeFld as format '99:99:99.99') as char(11)) as time(6)) from DBC.EventLog 
依照当前时间得到timestamp: select cast(current_date as timestamp(2)) + ((current_time - time '00:00:00') hour to second);
上个星期五:select * from sys_calendar.calendar
where day_of_week = 6 --星期五
and calendar_date between date -6 and date; --上个星期
上周的今天:select * from sys_calendar.calendar where calendar_date = date-7

转载地址:http://surli.baihongyu.com/

你可能感兴趣的文章
九度OJ 1471-1480(10/10)
查看>>
九度OJ 1481-1490(7/10)
查看>>
九度OJ 1491-1500(5/10)
查看>>
九度OJ 1501-1510(10/10)
查看>>
业务系统中,报表统计功能如何组织--统计分析模块参考
查看>>
面向数据集成的ETL技术研究
查看>>
DataStage(ETL)技术总结 -- 介绍篇(转载)
查看>>
Greenplum技术浅析--vs oracle RAC
查看>>
框架一
查看>>
Oracle-内存管理解读
查看>>
Oracle-PFILE和SPFILE解读
查看>>
leetcode 13: Roman to Integer
查看>>
a标签中调用js方法
查看>>
js函数中传入的event参数
查看>>
[hive]优化策略
查看>>
c++14现代内存管理
查看>>
右值引用,move语义和完美转发
查看>>
c++使用宏检测类是否包含某个函数或者变量属性
查看>>
CSS3之Transition
查看>>
CSS之media Query
查看>>