当前位置:网站首页>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
边栏推荐
- Rotation order and universal lock of unity panel
- Function, condition, regular expression
- Research Report on development monitoring and investment prospects of China's smart environmental protection industry (2022 Edition)
- D @ safety and dip1000
- Redis主从实现10秒检查与恢复
- Detailed explanation of string's trim() and substring()
- 剑指 Offer 20. 表示数值的字符串
- New patent applications and transfers
- Petrv2: a unified framework for 3D perception of multi camera images
- Thinkphp6 - CMS multi wechat management system source code
猜你喜欢

(27) Open operation, close operation, morphological gradient, top hat, black hat

Sword finger offer 20 String representing numeric value

Fresh, 2022 advanced Android interview must know 100 questions (interview questions + answer analysis)

Thinkphp6 - CMS multi wechat management system source code

Heavy disclosure! Hundreds of important information systems have been invaded, and the host has become a key attack target

Detailed explanation of string's trim() and substring()
![[Verilog quick start of Niuke network question brushing series] ~ priority encoder circuit ①](/img/24/23f6534e2c74724f9512c5b18661b6.png)
[Verilog quick start of Niuke network question brushing series] ~ priority encoder circuit ①

LeetCode中等题之TinyURL 的加密与解密

What are the legal risks of NFT brought by stars such as curry and O'Neill?

Intelligent operation and maintenance practice: banking business process and single transaction tracking
随机推荐
Encryption and decryption of tinyurl in leetcode
Pyqt5, draw a histogram on the control
Research Report on China's enzyme Market Forecast and investment strategy (2022 Edition)
The latest intelligent factory MES management system software solution
(1) CNN network structure
Software construction scheme of smart factory collaborative management and control application system
Research Report on development prediction and investment direction of nylon filament sewing thread in China (2022 Edition)
At present, where is the most formal and safe account opening for futures speculation? How to open a futures account?
RadHat搭建内网YUM源服务器
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
深度优先遍历和广度优先遍历[通俗易懂]
传感器尺寸、像素、DPI分辨率、英寸、毫米的关系
Code example of libcurl download file
Sword finger offer 20 String representing numeric value
MySQL -- explain performance optimization
MySQL + JSON = King fried
EasyCVR通过国标GB28181协议接入设备,出现设备自动拉流是什么原因?
What are the legal risks of NFT brought by stars such as curry and O'Neill?
PIP version problems: PIP problems still occur when installing akshare and using Tsinghua source and Douban source
Redis -- data type and operation