当前位置:网站首页>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
边栏推荐
- Is Huishang futures a regular futures platform? Is it safe to open an account in Huishang futures?
- DRF --- response rewrite
- SPIE Western optoelectronics exhibition returned offline and successfully held a science and engineering event
- Kia recalls some K3 new energy with potential safety hazards
- DNS
- 两数之和c语言实现[通俗易懂]
- Heavy disclosure! Hundreds of important information systems have been invaded, and the host has become a key attack target
- China acetonitrile market forecast and strategic consulting research report (2022 Edition)
- Vulnhub range hacksudo Thor
- Apache iceberg source code analysis: schema evolution
猜你喜欢
Cassette helicopter and alternating electric field magnetic manometer DPC
Penetration practice vulnhub range Nemesis
[C supplement] [string] display the schedule of a month by date
(1) CNN network structure
June issue | antdb database participated in the preparation of the "Database Development Research Report" and appeared on the list of information technology and entrepreneurship industries
Penetration practice vulnhub range Keyring
Good looking UI mall source code has been scanned, no back door, no encryption
New 95 community system whole station source code
Roewe rx5's "a little more" product strategy
Intel's open source deep learning tool library openvino will increase cooperation with local software and hardware parties and continue to open
随机推荐
Key points on February 15, 2022
In aks, use secret in CSI driver mount key vault
Wechat applet blind box - docking wechat payment
Setting up a time server requires the client to automatically synchronize the time of the server at 9 a.m. every day
Euler function: find the number of numbers less than or equal to N and coprime with n
ArrayList扩容详解
About selenium element positioning being overwritten
PETRv2:一个多摄像头图像3D感知的统一框架
Good looking UI mall source code has been scanned, no back door, no encryption
Redis -- data type and operation
Sword finger offer II 105 Maximum area of the island
Countdownlatch blocking wait for multithreading concurrency
SPIE Western optoelectronics exhibition returned offline and successfully held a science and engineering event
Cassette helicopter and alternating electric field magnetic manometer DPC
聊聊项目经理最爱使用的工具
transform. Forward and vector3 Differences in the use of forward
Three dimensional anti-terrorism Simulation Drill deduction training system software
Technical secrets of ByteDance data platform: implementation and optimization of complex query based on Clickhouse
There is a new breakthrough in quantum field: the duration of quantum state can exceed 5 seconds
PHP implements sensitive word filtering system "suggestions collection"