- trunc()函数;
- round()函数;
- EXTRACT()函数;
- to_char()函数;
- interval 间隔计算;
?
-- 获取时间
?
?
select sysdate "sysdate" from dual; sysdate ------------------------- 2013/8/5 10:20:14
?
?
?
-- 日期精确到 年 月 日 时 分 秒 季度 世纪
-- trunc() & round() 这两个函数经常被使用在数值处理中,日期类型中同样适用。
TRUNC(date [, fmt ])
ROUND(date [, fmt ])
fmt列表如下:
?
Table 5-14?lists the format models you can use with the?ROUND
?and?TRUNC
?date functions and the units to which they round and truncate dates. The default model, 'DD', returns the date rounded or truncated to the day with a time of midnight.
Table 5-14?Date Format Models for the ROUND and TRUNC Date Functions
CC SCC |
One greater than the first two digits of a four-digit year |
SYYYY YYYY YEAR SYEAR YYY YY Y |
Year (rounds up on July 1) |
IYYY IY IY I |
ISO Year |
Q |
Quarter (rounds up on the sixteenth day of the second month of the quarter) |
MONTH MON MM RM |
Month (rounds up on the sixteenth day) |
WW |
Same day of the week as the first day of the year |
IW |
Same day of the week as the first day of the ISO year |
W |
Same day of the week as the first day of the month |
DDD DD J |
Day |
DAY DY D |
Starting day of the week |
HH HH12 HH24 |
Hour |
MI |
Minute
免责声明: 本文仅代表作者个人观点,与爱易网无关。其原创性以及文中陈述文字和内容未经本站证实,对本文以及其中全部或者部分内容、文字的真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
|