oracle 将日期转换为 'YYYYMMDDHH24miSS' 格式

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/36151398/
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 03:11:38  来源:igfitidea点击:

Convert a date into 'YYYYMMDDHH24miSS' format

sqloracle

提问by baboufight

I'm trying to convert dates having this format '2012/11/24 13:32' into this format 'YYYYMMDDHH24miSS'.

我正在尝试将具有这种格式“2012/11/24 13:32”的日期转换为这种格式“YYYYMMDDHH24miSS”。

I've tried using to_char and to_timestamp functions, but it didn't work.

我试过使用 to_char 和 to_timestamp 函数,但是没有用。

回答by StefanG

Are you looking for a char to date and than a date to char conversion?

您是否正在寻找迄今为止的字符而不是日期到字符的转换?

SQL> select to_char(to_date('2012/11/24 13:32','yyyy/mm/dd hh24:mi'),'YYYYMMDDHH24miSS') res from dual;

RES
--------------
20121124133200

Regards

问候