DB client shows only date without time component..how can I convert?
I am saving date with time into DB and using SQL De开发者_JAVA技巧veloper which by default shows just date. I know its matter of client config but I have seen query in Oracle that returned time component of date when one was present. Something like convert (HH:MM:SS). I am just interested in this one.
To show the time element of all dates as a one-off exercise use this DDL statement.
ALTER SESSION set nls_date_format = 'DD-MON-YYYY HH24:MI:SS'
/
or whatever date mask takes your fancy.
To set this permanently in SQL Developer, set parameters in
Tools -> Preferences -> Database -> NLS Parameters
I you understand that it's a matter of client config and want to see time portion of date for some special purpose you can query it converting to char like this:
select to_char(sysdate, 'yyyy.mm.dd hh24:mi:ss') from dual;
More info on date format can be found here or in official docs
精彩评论