oracle trunc函数截取日期

1.select trunc(sysdate) from dual 
2.select trunc(sysdate, ‘mm‘)  from dual 
3.select trunc(sysdate,‘yy‘) from dual 
4.select trunc(sysdate,‘dd‘) from dual 
5.select trunc(sysdate,‘yyyy‘) from dual 
6.select trunc(sysdate,‘d‘) from dual 
7.select trunc(sysdate, ‘hh‘) from dual  
8.select trunc(sysdate, ‘mi‘) from dual

时间: 2024-08-14 08:13:29

oracle trunc函数截取日期的相关文章

oracle trunc 函数处理日期格式

oracle trunc 函数处理日期格式 select TRUNC(LAST_DAY(SYSDATE))+29+20/24 from dual--下个月的某一天几点几分 2015/11/29 20:00:00 select add_months(TRUNC(SYSDATE,'mm'),1)+5/24 from dual--下个月1号的几点2015/11/1 5:00:00 select to_char(sysdate,'yyyy-mm-dd hh24:mi:ss') from dual;  -

oracle trunc 函数处理日期格式,

select to_char(sysdate, 'yyyy-mm-dd hh24:mi:ss') from dual; --显示当前时间 2017 - 04 - 24 18 :42 :17 select trunc(sysdate, 'year') from dual; --截取到年(本年的第一天) 2017 / 1 / 1 select trunc(sysdate, 'q') from dual; --截取到季度(本季度的第一天) 2017 / 4 / 1 select trunc(sysda

Oracle trunc()函数的用法

--Oracle trunc()函数的用法 /**************日期  TRUNC()函数没有秒的精确 ********************/ select sysdate from dual --当时日期 select trunc(sysdate) from dual select trunc(sysdate ,'DD') from dual --今天日期 select trunc(sysdate,'d')+7 from dual --本周星期日 select trunc(sys

[转]Oracle trunc()函数的用法

原文地址:http://www.cnblogs.com/gengaixue/archive/2012/11/21/2781037.html 1.TRUNC(for dates) TRUNC函数为指定元素而截去的日期值. 其具体的语法格式如下: TRUNC(date[,fmt]) 其中: date 一个日期值 fmt 日期格式,该日期将由指定的元素格式所截去.忽略它则由最近的日期截去 下面是该函数的使用情况: TRUNC(TO_DATE('24-Nov-1999 08:00 pm'),'dd-mo

Oracle trunc()函数

--Oracle trunc()函数的用法/**************日期********************/1.select trunc(sysdate) from dual --2013-01-06 今天的日期为2013-01-062.select trunc(sysdate, 'mm') from dual --2013-01-01 返回当月第一天.3.select trunc(sysdate,'yy') from dual --2013-01-01 返回当年第一天4.select

oracle trunc函数

select to_char(sysdate, 'yyyy-mm-dd hh24:mi:ss'), to_char(trunc(sysdate), 'yyyy-mm-dd hh24:mi:ss') from dual t;--sysdate和trunc(sysdate)是不一样的 sysdate在当天的零时零分零秒等于trunc(sysdate) select trunc(sysdate, 'dd'), trunc(sysdate) from dual t; --今天 20140703 零时零分

oracle获取本月第一天和最后一天及Oracle trunc()函数的用法

select to_char(trunc(add_months(last_day(sysdate), -1) + 1), 'yyyy-mm-dd') "本月第一天",to_char(last_day(sysdate), 'yyyy-mm-dd') "本月最后一天"–Oracle trunc()函数的用法/**************日期********************/1.select trunc(sysdate) from dual  –2011-3-18

Oracle trunc函数使用

select to_char(sysdate, 'yyyy-mm-dd hh24:mi:ss'), to_char(trunc(sysdate), 'yyyy-mm-dd hh24:mi:ss') from dual t;--sysdate和trunc(sysdate)是不一样的 sysdate在当天的零时零分零秒等于trunc(sysdate) select trunc(sysdate, 'dd'), trunc(sysdate) from dual t; --今天 20140703 零时零分

oracle trunc()函数用法-1

1.TRUNC(for dates) TRUNC函数为指定元素而截去的日期值. 其具体的语法格式如下: TRUNC(date[,fmt]) 其中: date 一个日期值 fmt 日期格式,该日期将由指定的元素格式所截去.忽略它则由最近的日期截去 下面是该函数的使用情况: TRUNC(TO_DATE('24-Nov-1999 08:00 pm','dd-mon-yyyy hh:mi am')) ='24-Nov-1999 12:00:00 am'