sql – 如何在Oracle中将日期转换为日期时间?

我在oracle中有这个格式的日期DD-MM-YYY,我想用其他格式将它转换为日期时间DD-MM-YYY HH24:MI我该怎么办?

我试过这个,但没有任何工作:

to_date(the_date,'DD-MM-YYY HH24:MI')

还有这个:

to_date(to_char(date_debut_p),'DD-MM-YYY HH24:MI')

解决方法

i have a date in oracle with this format DD-MM-YYY and i want to convert it to datetime with this other format DD-MM-YYY HH24:MI

不,你很困惑. Oracle does not store dates in the format you see.内部存储7个字节,每个字节存储日期时间值的不同组件.

DATE数据类型始终具有日期和时间元素,精度为秒.

如果要显示,请使用TO_CHAR和正确的格式模型.

例如,

sql> select to_char(sysdate,'mm/dd/yyyy hh24:mi:ss') from dual;

TO_CHAR(SYSDATE,'MM
-------------------
11/25/2015 22:25:42

相关文章

SELECT a.*,b.dp_name,c.pa_name,fm_name=(CASE WHEN a.fm_n...
if not exists(select name from syscolumns where name=&am...
select a.*,pano=a.pa_no,b.pa_name,f.dp_name,e.fw_state_n...
要在 SQL Server 2019 中设置定时自动重启,可以使用 Window...
您收到的错误消息表明数据库 'EastRiver' 的...
首先我需要查询出需要使用SQL Server Profiler跟踪的数据库标...