Oracle's default date format is YYYY-MM-DD, WHY?
Oracle's default date format is YYYY-MM-DD. Which means if I do:
select some_date from some_table
...I lose the time portion of my date.
Yes, I know you can "fix" this with:
alter session set nls_date_format='yyyy-mm-dd hh24:mi:ss';
But seriously, why isn't the above the default? Especially in a DBMS where the two primary time-tracking data types (DATE and TIMESTAMP) both have a time component that includes (at least) accuracy down to 1 second.
Solution 1:
Are you sure you're not confusing Oracle database with Oracle SQL Developer?
The database itself has no date format, the date comes out of the database in raw form. It's up to the client software to render it, and SQL Developer does use YYYY-MM-DD as its default format, which is next to useless, I agree.
edit: As was commented below, SQL Developer can be reconfigured to display DATE values properly, it just has bad defaults.
Solution 2:
If you are using this query to generate an input file for your Data Warehouse, then you need to format the data appropriately. Essentially in that case you are converting the date (which does have a time component) to a string. You need to explicitly format your string or change your nls_date_format to set the default. In your query you could simply do:
select to_char(some_date, 'yyyy-mm-dd hh24:mi:ss') my_date
from some_table;
Solution 3:
The format YYYY-MM-DD is part of ISO8601 a standard for the exchange of date (and time) information.
It's very brave of Oracle to adopt an ISO standard like this, but at the same time, strange they didn't go all the way.
In general people resist anything different, but there are many good International reasons for it.
I know I'm saying revolutionary things, but we should all embrace ISO standards, even it we do it a bit at a time.