当前位置:网站首页>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
边栏推荐
- pyqt5中,在控件上画柱状图
- An example of data analysis of an old swatch and an old hard disk disassembly and assembly combined with the sensor of an electromagnetic press
- Research Report on development prediction and investment direction of nylon filament sewing thread in China (2022 Edition)
- Develop those things: easycvr cluster device management page function display optimization
- Nielseniq found that 60% of the re launched products had poor returns
- Development cost of smart factory management system software platform
- Debiasing word embeddings | talking about word embedding and deviation removal # yyds dry goods inventory #
- golang中的select详解
- Openlayers customize bubble boxes and navigate to bubble boxes
- SPIE Western optoelectronics exhibition returned offline and successfully held a science and engineering event
猜你喜欢
ISO 27001 Information Security Management System Certification
The difference and relationship between iteratible objects, iterators and generators
Data warehouse (3) star model and dimension modeling of data warehouse modeling
String的trim()和substring()详解
SQL injection vulnerability (MySQL and MSSQL features)
Common design parameters of solid rocket motor
Intelligent operation and maintenance practice: banking business process and single transaction tracking
Gold, silver and four job hopping, interview questions are prepared, and Ali becomes the champion
Penetration practice vulnhub range Nemesis
[PHP foundation] realize the connection between PHP and SQL database
随机推荐
中国茂金属聚乙烯(mPE)行业研究报告(2022版)
SPIE Western optoelectronics exhibition returned offline and successfully held a science and engineering event
麦趣尔:媒体报道所涉两批次产品已下架封存,受理消费者诉求
LeetCode中等题之TinyURL 的加密与解密
Report on research and investment prospects of UHMWPE industry in China (2022 Edition)
Unity3d extended toolbar
Product service, operation characteristics
JDBC: deep understanding of Preparedstatement and statement[easy to understand]
DRF --- response rewrite
To improve the efficiency of office collaboration, trackup may be the best choice
How to write good code - Defensive Programming Guide
Is it safe to open an ETF account online? What are the steps?
Common design parameters of solid rocket motor
Openlayers customize bubble boxes and navigate to bubble boxes
Why should you consider using prism
Oom caused by improper use of multithreading
官宣!香港科技大学(广州)获批!
An example of data analysis of an old swatch and an old hard disk disassembly and assembly combined with the sensor of an electromagnetic press
String的trim()和substring()详解
PHP implements sensitive word filtering system "suggestions collection"