惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

S
Secure Thoughts
S
Securelist
T
The Exploit Database - CXSecurity.com
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
Schneier on Security
Schneier on Security
P
Proofpoint News Feed
Latest news
Latest news
C
CXSECURITY Database RSS Feed - CXSecurity.com
Google DeepMind News
Google DeepMind News
Microsoft Security Blog
Microsoft Security Blog
美团技术团队
T
Threat Research - Cisco Blogs
Know Your Adversary
Know Your Adversary
AWS News Blog
AWS News Blog
V2EX - 技术
V2EX - 技术
云风的 BLOG
云风的 BLOG
博客园 - 聂微东
腾讯CDC
月光博客
月光博客
G
Google Developers Blog
F
Fortinet All Blogs
C
Cybersecurity and Infrastructure Security Agency CISA
Hacker News - Newest:
Hacker News - Newest: "LLM"
阮一峰的网络日志
阮一峰的网络日志
Last Week in AI
Last Week in AI
Apple Machine Learning Research
Apple Machine Learning Research
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
爱范儿
爱范儿
WordPress大学
WordPress大学
Spread Privacy
Spread Privacy
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
T
Threatpost
N
News and Events Feed by Topic
Y
Y Combinator Blog
J
Java Code Geeks
N
News and Events Feed by Topic
T
Troy Hunt's Blog
Project Zero
Project Zero
博客园 - 【当耐特】
Microsoft Azure Blog
Microsoft Azure Blog
C
CERT Recently Published Vulnerability Notes
小众软件
小众软件
有赞技术团队
有赞技术团队
罗磊的独立博客
Martin Fowler
Martin Fowler
L
LINUX DO - 最新话题
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
www.infosecurity-magazine.com
www.infosecurity-magazine.com
P
Proofpoint News Feed

博客园 - Leetle

win2000/xp/2003下完全卸载ORACLE Oracle9i中分区partition的使用 [ZT]Oracle数据库字符集问题解决方案大全 Oracle 8.1.6 for Win2000 系统文件解释 如何连接oracle数据库及故障解决办法 Oracle 9i初始化参数文件 简单冷备份恢复操作步骤 Win 下常用的oracle 9i服务的介绍 oracle初始化参数说明 Oracle中的数据字典技术初级入门 【转帖】揭露不为人所知的招聘网站的秘密, 业内人士告诉你:为何你的简历石沉大海?! 市场盈亏指标CYS的使用技巧 炒股短线招术(完整版) DBA常用SQL语句系列 Function怎么返回一个数据集 Oracle 9i 分析函数参考手册 使用Oracle的分析函数ROW_NUMBER、DENSE_RANK、RANK oracle日期处理完全版(三) oracle日期处理完全版(二)
oracle日期处理完全版(一)
Leetle · 2007-04-06 · via 博客园 - Leetle

TO_DATE格式 
Day: 
dd number 12 
dy abbreviated fri 
day spelled out friday 
ddspth spelled out, ordinal twelfth 
Month: 
mm number 03 
mon abbreviated mar 
month spelled out march 
Year: 
yy two digits 98 
yyyy four digits 1998 

24小时格式下时间范围为: 0:00:00 - 23:59:59.... 
12小时格式下时间范围为: 1:00:00 - 12:59:59 .... 

1. 
日期和字符转换函数用法(to_date,to_char) 

2. 
select to_char( to_date(222,'J'),'Jsp') from dual 

显示Two Hundred Twenty-Two 

3. 
求某天是星期几 
select to_char(to_date('2002-08-26','yyyy-mm-dd'),'day') from dual; 
星期一 
select to_char(to_date('2002-08-26','yyyy-mm-dd'),'day','NLS_DATE_LANGUAGE = American') from dual; 
monday 
设置日期语言 
ALTER SESSION SET NLS_DATE_LANGUAGE='AMERICAN'; 
也可以这样 
TO_DATE ('2002-08-26', 'YYYY-mm-dd', 'NLS_DATE_LANGUAGE = American') 

4. 
两个日期间的天数 
select floor(sysdate - to_date('20020405','yyyymmdd')) from dual; 

5. 时间为null的用法 
select id, active_date from table1 
UNION 
select 1, TO_DATE(null) from dual; 

注意要用TO_DATE(null) 

6. 
a_date between to_date('20011201','yyyymmdd') and to_date('20011231','yyyymmdd') 
那么12月31号中午12点之后和12月1号的12点之前是不包含在这个范围之内的。 
所以,当时间需要精确的时候,觉得to_char还是必要的 
7. 日期格式冲突问题 
输入的格式要看你安装的ORACLE字符集的类型, 比如: US7ASCII, date格式的类型就是: '01-Jan-01' 
alter system set NLS_DATE_LANGUAGE = American 
alter session set NLS_DATE_LANGUAGE = American 
或者在to_date中写 
select to_char(to_date('2002-08-26','yyyy-mm-dd'),'day','NLS_DATE_LANGUAGE = American') from dual; 
注意我这只是举了NLS_DATE_LANGUAGE,当然还有很多, 
可查看 
select * from nls_session_parameters 
select * from V$NLS_PARAMETERS