当前位置:网站首页>Oracle TRUNC function processing date format
Oracle TRUNC function processing date format
2022-07-01 17:52:00 【Morida Technology】
GPS platform 、 Website construction 、 software development 、 The system operational , Find Senda network technology !
https://cnsendnet.taobao.com
From the official blog of Sunda Technology
http://www.cnsendblog.com/index.php/?p=2204
Another explanation , After interception, the result is still date data type
- 1.
select
to_char(sysdate,'yyyy-mm-dd hh24:mi:ss') from dual; -- Display current time
2011-12-29 16:24:34
select
trunc(sysdate,'year') from dual; -- Cut to year ( The first day of the year )
2011-1-1
select
trunc(sysdate,'q') from dual; -- Intercept to quarter ( The first day of the quarter )
2011-10-1
select
trunc(sysdate,'month') from dual; -- Intercept to month ( The first day of the month )
2011-12-1
select trunc(sysdate,'')
from dual;
empty
select
to_char(trunc(sysdate),'yyyymmdd hh24:mi:ss') from dual; -- The default interception date is ( Zero minute and zero second of the day )
20111229 00:00:00
trunc(sysdate) This is the intercept date section , When you need to use dates for grouping , You can use this function , As shown below edit by sand

select trunc(sysdate-1,'w') from dual; -- The Thursday closest to the current time , If the current day is Thursday, return to the current day , Otherwise, return to last Thursday 2011-12-22
select
trunc(sysdate,'ww') from dual; -- Intercepted last weekend ( Last Saturday )2011-12-24
select
trunc(sysdate,'day') from dual; -- Intercept to week ( First day of the week , Last Sunday )2011-12-25
select
trunc(sysdate,'iw') from dual; -- This week 2 God , This Monday 2011-12-26
select
to_char(trunc(sysdate,'dd'),'yyyymmdd hh24:mi:ss') from dual;-- Intercept to day ( Zero minute and zero second of the day )20111229 00:00:00
select
trunc(sysdate,'hh24') from dual; -- Intercept to hours ( Current hour , Zero minute zero second )2011-12-29 16:00:00
select
trunc(sysdate,'mi') from dual; -- Intercept points ( The current points , Zero seconds )2011-12-29 16:24:00
select
trunc(sysdate,'ss') from dual ;-- Report errors , There is no format accurate to seconds
GPS platform 、 Website construction 、 software development 、 The system operational , Find Senda network technology !
https://cnsendnet.taobao.com
From the official blog of Sunda Technology
边栏推荐
- Product service, operation characteristics
- EasyCVR设备录像出现无法播放现象的问题修复
- ACM mm 2022 video understanding challenge video classification track champion autox team technology sharing
- Penetration practice vulnhub range Tornado
- China metallocene polyethylene (MPE) Industry Research Report (2022 Edition)
- Encryption and decryption of tinyurl in leetcode
- 网上股票开户安全吗?是否可靠?
- Detailed explanation of string's trim() and substring()
- 【牛客网刷题系列 之 Verilog快速入门】~ 优先编码器电路①
- [C supplement] [string] display the schedule of a month by date
猜你喜欢
![[PHP foundation] realize the connection between PHP and SQL database](/img/eb/c8953eddfe3b19b0adb5529957d275.jpg)
[PHP foundation] realize the connection between PHP and SQL database

整形数组合并【JS】

PETRv2:一个多摄像头图像3D感知的统一框架

(16) ADC conversion experiment

ACM mm 2022 video understanding challenge video classification track champion autox team technology sharing

vulnhub靶场-Hacker_Kid-v1.0.1

Common design parameters of solid rocket motor
Roewe rx5's "a little more" product strategy

Replace UUID, nanoid is faster and safer!

New 95 community system whole station source code
随机推荐
JDBC: deep understanding of Preparedstatement and statement[easy to understand]
(27) Open operation, close operation, morphological gradient, top hat, black hat
Heavy disclosure! Hundreds of important information systems have been invaded, and the host has become a key attack target
Source code of new campus errand / campus task platform on mutual station
(十六)ADC转换实验
线上开通ETF基金账户安全吗?有哪些步骤?
Rotation order and universal lock of unity panel
反射型XSS漏洞
Detailed explanation of ArrayList expansion
In depth Research Report on China's disposable sanitary products production equipment industry (2022 Edition)
Report on research and investment prospects of China's silicon nitride ceramic substrate industry (2022 Edition)
开发那些事儿:EasyCVR平台添加播放地址鉴权
L'ouverture d'un compte d'actions en ligne est - elle sécurisée? Fiable?
Reflective XSS vulnerability
China biodegradable plastics market forecast and investment strategy report (2022 Edition)
官宣!香港科技大学(广州)获批!
Wechat applet blind box - docking wechat payment
China acetonitrile market forecast and strategic consulting research report (2022 Edition)
Openlayers customize bubble boxes and navigate to bubble boxes
Thinkphp6 - CMS multi wechat management system source code