在 Oracle 中将 yyyy/mm/dd hh24:mi:ss 转换为 dd-mon-yyyy 格式

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/26928209/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 02:37:26  来源:igfitidea点击:

Convert yyyy/mm/dd hh24:mi:ss to dd-mon-yyyy format in Oracle

sqloracledatedatetimedate-formatting

提问by manju

Currently i have date in the

目前我有日期

2006/01/01 00:00:00

2006/01/01 00:00:00

What should i use to convert it into following format

我应该用什么将其转换为以下格式

01-JAN-2006.

2006 年 1 月 1 日。

回答by Multisync

if it's a string use

如果是字符串使用

to_char(to_date('2006/01/01 00:00:00', 'YYYY/MM/DD HH24:MI:SS'), 'DD-MON-YYYY')

If it's a DATE use

如果是 DATE 使用

to_char(date_val, 'DD-MON-YYYY')

BUT whether you'll get JAN or national abbr of January depends on your NLS settings (session and database)

但是,您是否会获得一月或一月的国家缩写取决于您的 NLS 设置(会话和数据库)