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.
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.
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.
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');
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With