Teradata 时间函数

时间差异(月):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
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值