如何在oracle中将日期转换为时间戳(DD-MON-YYYY HH24:MI:SS.FF格式)? [英] How to convert date to timestamp(DD-MON-YYYY HH24:MI:SS.FF format) in oracle?

查看:232
本文介绍了如何在oracle中将日期转换为时间戳(DD-MON-YYYY HH24:MI:SS.FF格式)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在下面的查询中尝试过,但是没有用

I tried below query but its not working

select 
    TO_TIMESTAMP(ColumnName(Data type Date), 'DD-MON-YYYYHH24:MI:SS.FF') 
from TableName 
where Changedate>='01-Dec-2015'

*我需要没有AM/PM指示的结果. 结果将是15-DEC-2015 15:16:42.045016

*I need the result without AM/PM indication. Result will be 15-DEC-2015 15:16:42.045016

推荐答案

如果我正确回答了您的问题,则需要采用上述格式的输出.那将是对字符的转换

If I got your question right you need the output in the mentioned Format. That would be a conversion to character

select to_char(cast(sysdate as timestamp),'DD-MON-YYYY HH24:MI:SS.FF') from dual

当然在上面的FF也总是000000

Of course in the above the FF would also always be 000000

但是,如果您有一个timestamp变量,则不会进行投射

But if you have a timestamp variable you would not cast

select to_char(systimestamp,'DD-MON-YYYY HH24:MI:SS.FF') from dual

这篇关于如何在oracle中将日期转换为时间戳(DD-MON-YYYY HH24:MI:SS.FF格式)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆