How to get datetime in 24hour format from oracle d

2020-05-24 21:30发布

问题:

Is there any other way to get datetime field from oracle database in 24hour format???like -> "select getxsddate(col_name) from tab_name" will get you datetime format as "2012-04-04T12:31:00"...I wanted to know if there are any other ways as i`m not satisfied with this format.

回答1:

select to_char(col_name, 'yyyy-mm-dd hh24:mi:ss') from tab_name

You can read more about to_char function here



回答2:

Another very simple way is to set, in the database nls parameters, the parameter date_format='DD-MM-YYYY HH24:MI:SS'



标签: oracle10g