当前位置:网站首页>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
边栏推荐
- Qt5 signal and slot mechanism (basic introduction to signal and slot)
- 【牛客刷题】NowCoder号称自己已经记住了1-100000之间所有的斐波那契数。 为了考验他,我们随便出一个数n,让他说出第n个斐波那契数。如果第n个斐波那契大于6位则只取后6位。
- Oracle概念二
- Autodesk Navisworks 2022软件安装包下载及安装教程
- C language teacher workload management system
- C語言教師工作量管理系統
- Huawei cloud devcloud launched four new capabilities, setting two domestic firsts
- How to write a resume?
- How to improve it electronic equipment performance management
- A robot is located in the upper left corner of an M x n grid. The robot can only move down or right one step at a time. The robot attempts to reach the lower right corner of the grid. How many differe
猜你喜欢

Software testing learning - dark horse programmer, software testing learning outline

Redis installation

全面解析零知识证明:消解扩容难题 重新定义「隐私安全」

医院预约挂号系统-系统结构

d3dx9_ What if 27.dll is lost? d3dx9_ How to repair 27.dll?

Leetcode 5. Longest Palindromic Substring

Leetcode 46 Full Permutation

Cesium realizes satellite orbit detour

Raspberry pie preliminary use
锚文本大量丢失的问题
随机推荐
[the way of programmer training] - 3 Character count statistics
CDH cluster installation
leetcode 92. Reverse linked list II
tensorflow求解泊松方程
Performance problems caused by redis cache invalidation and competitive loading
Some details of Huawei OSPF
Annual comprehensive analysis of China's audio market in 2022
Leetcode daily practice (sum of two numbers)
Hierarchical clustering and case analysis
数据中心表格报表实现定制统计加班请假汇总记录分享
软件测试-测试的概念,单元测试的详细介绍,如何设计测试用例
C語言教師工作量管理系統
Oracle concept II
Simulated process scheduling
d3dx9_ How to repair 33.dll? d3dx9_ What if 33.dll is lost?
Unity shadow shadow pancaking
Halcon: discrete digital OCR recognition
C语言集合运算
[fxcg] today's market analysis
软件测试学习-黑马程序员,软件测试学习大纲