Reputation: 79
Oracle SQL Developer Version 18.2.0.183, Build 183.1748 (READ ONLY ACCESS TO DB FOR QUERIES)
My query is as follows:
SELECT
DBSTAGE.DATE_FORMAT(DBSTAGE.OAWOM.CHECKINDATE) "Checked In Date MM/DD/YYYY"
FROM
DBSTAGE.OAWOM
WHERE
DBSTAGE.OAWOM.WOSTATUS = 'CP'
In the CHECKINDATE field portion of My query it returns data in the date format of 15-FEB-19 which is a DD-MM-YY format. I need it to instead be in the format of MM/DD/YYYY. I don't know how to accomplish that, Please help.
Upvotes: 0
Views: 3452
Reputation: 1270993
In Oracle, you use to_char()
to convert the date to a string in the format you want:
select to_char(datecol, 'MM/DD/YYYY')
For specifying literals in a query, I strongly recommend the date
keyword with YYYY-MM-DD standard format:
select date '1776-07-04'
You seem to want:
SELECT TO_CHAR(o.CHECKINDATE, 'MM/DD/YYYY') as checkindate_mmddyyyy
FROM DBSTAGE.OAWOM o
WHERE o.WOSTATUS = 'CP';
EDIT:
You may need the function DBSTAGE.DATE_FORMAT()
to convert your column to a valid date format:
SELECT TO_CHAR(DBSTAGE.DATE_FORMAT(o.CHECKINDATE), 'MM/DD/YYYY') as checkindate_mmddyyyy
FROM DBSTAGE.OAWOM o
WHERE o.WOSTATUS = 'CP';
Upvotes: 3