当前位置:网站首页>Oracle TRUNC function processing date format
Oracle TRUNC function processing date format
2022-06-27 17:20:00 【Senda 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
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
http://www.cnsendblog.com/index.php/?p=2204
边栏推荐
- Ti Click: quickly set up tidb online laboratory through browser | ti- team interview can be conducted immediately
- d3dx9_ Where is 35.dll? d3dx9_ Where can I download 35.dll
- 医院预约挂号系统-系统结构
- Construction and management practice of ByteDance buried point data flow
- Deeply digitise, lead cloud nativity and serve more developers
- Defiato is an innovation that combines user-friendly features of a centralized platform with defi services
- Autodesk NavisWorks 2022 software installation package download and installation tutorial
- 事件监听机制
- Electronic smart package tutorial
- Impressive questions
猜你喜欢

树莓派初步使用

Annual comprehensive analysis of China's audio market in 2022

Cesium realizes satellite orbit detour

Halcon: discrete digital OCR recognition

Ti Click: quickly set up tidb online laboratory through browser | ti- team interview can be conducted immediately

如何提升IT电子设备效能管理

Array represents a collection of several intervals. Please merge all overlapping intervals and return a non overlapping interval array. The array must exactly cover all the intervals in the input. 【Le

Determine the maximum number of specific words in a string

Kubernetes基础自学系列 | Ingress API讲解

leetcode 92. Reverse linked list II
随机推荐
Part 30 supplement (30) ECMAScript object
Delete duplicate elements in the sorting linked list
Handwritten promise series - all
Impressive questions
Leetcode 704. Binary search
关于#mysql#的问题:问题遇到的现象和发生背景
Raspberry pie preliminary use
继手机之后 报道称三星也削减了电视等家电产品线的产量
About how vs2019c # establishes the login interface, the user name and password entered must match the records in the access database
C语言教师工作量管理系统
About MySQL: the phenomenon and background of the problem
Qt5 signal and slot mechanism (basic introduction to signal and slot)
Defiato is an innovation that combines user-friendly features of a centralized platform with defi services
Construction and management practice of ByteDance buried point data flow
National food safety risk assessment center: do not blindly and unilaterally pursue "zero addition" and "pure natural" food
Community sharing jumpserver in the eyes of senior open source users: a fortress machine for "Crazy" iteration
leetcode 70. climb stairs
华为云首次解读云原生2.0十大典型架构,加速构建现代化应用
Byte + Google super full kotlin learning King fried notes! Kotlin introductory tutorial + Advanced kotlin enhanced actual combat (with demo)
一个机器人位于一个 m x n 网格的左上角 。机器人每次只能向下或者向右移动一步。机器人试图达到网格的右下角。问总共有多少条不同的路径?【LeetCodeHot100】