Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to key in and display date with hours and minutes into Oracle SQL Developer?

I'm using Oracle SQL Developer. I'd like to key in dates with hours and minutes, but the GUI doesn't appear to allow that. While I'm at it, it would be nice to display all date fields as 'YYYY-MM-DD HH24:MI:SS' within the Oracle SQL Developer GUI as well.

like image 376
Denis M. Kitchen Avatar asked Mar 09 '10 18:03

Denis M. Kitchen


People also ask

How do I add hours to a date in SQL Developer?

How can I add hours to a date/time format? select sysdate, sysdate + interval '300' "5 hours" from dual; As we see, there are several ways to add hours to an Oracle date column.

How do I display a date in YYYY MM DD format in Oracle?

Use TO_CHAR to display it in any format you like. For example: SELECT TO_CHAR ( TO_DATE (date_value, 'yyyy-mm-dd') , 'mm/dd/yyyy' ) FROM table_x; Things are much easier if you store dates in DATE columns.

How do I declare a date variable in Oracle SQL Developer?

Answer: We can declare a date variable in PL/SQL with the syntax given below: DECLARE stdt DATE := to_date ('06/06/2006', 'DD/MM/YYYY');


1 Answers

After some more poking around I found the right preference setting (screen shot below).

Under "Tools -> Preference" there is a Database:NLS node you can configure. The setting I changed was "Date Format", which I changed to 'YYYY-MM-DD HH24:MI:SS'.

I had to restart SQL Developer in order for these changes to take effect. After that, dates display as I want, and the input mask on the GUI also allowed me to edit time.

NLS Setting in Oracle SQL Developer

like image 174
Denis M. Kitchen Avatar answered Oct 19 '22 02:10

Denis M. Kitchen