Reputation: 25
I'm trying to change the format of the date from dd-mon-yyyy to mm/dd/yyyy, but it needs to be able to retain the date property when exported to an Excel spreadsheet. The to_char function changes it to text which then I have to manually change the field type back to date in order to be able to sort by date rather than alphabetically.
Upvotes: 0
Views: 196
Reputation: 484
It depends on what datatype you are using (DATE or TIMESTAMP). Try to change the NLS parameter accordingly:
ALTER SESSION SET NLS_DATE_FORMAT = 'mm/dd/yyyy';
ALTER SESSION SET NLS_TIMESTAMP_FORMAT = 'mm/dd/yyyy';
Upvotes: 1