oracle 时间
时间:2021-07-01 10:21:17
帮助过:2人阅读
to_char(to_date(sysdate,
‘yyyy-mm-dd‘),
‘day‘)
from dual;
select to_date(
‘2017-12-31‘,
‘day‘)
from dual;
select sysdate,to_char(sysdate,
‘yyyy-mm-dd hh24:mi:ss‘)
from dual;
select sysdate,to_char(sysdate,
‘yyyy-mm-dd hh:mi:ss‘)
from dual;
select sysdate,to_char(sysdate,
‘yyyy-ddd hh:mi:ss‘)
from dual;
select sysdate,to_char(sysdate,
‘yyyy-mm iw-d hh:mi:ss‘)
from dual;
select TO_CHAR(SYSDATE,
‘YYYYMMDD‘) res
from dual;
select TRUNC(LAST_DAY(SYSDATE))
+1 res
from dual;
select TO_CHAR(TRUNC(sysdate)
+ 3,
‘YYYYMMDD‘) res
from dual;
select to_date(
‘1996‘,
‘yyyy‘)
- to_date(
‘1995‘,
‘yyyy‘)
from dual;
select to_date(
‘1995‘,
‘yyyy‘)
- to_date(
‘1994‘,
‘yyyy‘)
from dual;
select to_date(
‘2008‘,
‘yyyy‘)
- to_date(
‘2007‘,
‘yyyy‘)
from dual;
select to_date(
‘2000‘,
‘yyyy‘)
- to_date(
‘1999‘,
‘yyyy‘)
from dual;
select to_date(
‘2004‘,
‘yyyy‘)
- to_date(
‘2003‘,
‘yyyy‘)
from dual;
select to_date(
‘2020‘,
‘yyyy‘)
- to_date(
‘2019‘,
‘yyyy‘)
from dual;
select to_date(sysdate,
‘yyyy‘)
- to_date(sysdate,
‘yyyy‘)
-1 from dual;
select ADD_MONTHS(trunc(sysdate,
‘yyyy‘),
12)
from dual;
select to_date(to_char(ADD_MONTHS(trunc(sysdate,
‘yyyy‘),
12)),
‘RRRR‘)
from dual;
select TO_CHAR(SYSDATE,
‘RRRR‘)
+ 1 from dual;
select to_date(TO_CHAR(SYSDATE,
‘RRRR‘),
‘yyyy‘)
- to_date(TO_CHAR(SYSDATE,
‘RRRR‘)
-1,
‘yyyy‘)
from dual;
select * from ADD_MONTHS(trunc(sysdate,
‘yyyy‘),
12)
+2/24 from dual;
select TO_CHAR(
‘2017-12-29‘,
‘DAY‘)
from dual;
--当前的年月日20171231
select TO_CHAR(TRUNC(sysdate)
+ 3,
‘YYYYMMDD‘) res
from dual;
select TO_CHAR(TRUNC(sysdate)
+ 3,
‘DS‘) res
from dual;
select to_char(to_date(TRUNC(sysdate),
‘yyyy-mm-dd‘),
‘d‘)
from dual;
select to_char(to_date(TRUNC(sysdate),
‘yyyy-mm-dd‘),
‘IW‘)
from dual;
oracle 时间
标签:font log blog sel sele nbsp rom col char