I need to add time zone to what is returned by Oracle SQL query.
SELECT
mw.appdate APPDATE
FROM
mwo mw
This returns:
APPDATE
23-SEP-2021 00:00:00
I was looking at ISO-8601 select to_char, but I'm not sure how to apply this to my query results.
SELECT
to_char(mw.appdate, 'YYYY-MM-DD"T"hh24:mi:sstzh:tze') APPDATE,
FROM
mwo mw
error:
ORA-01821: date format not recognized
01821. 00000 - "date format not recognized"
*Cause:
*Action:
I'm not that familiar with formatting dates. How do I format this to add time zone (eastern standard time).
I tried
SELECT
to_char(mw.appdate, 'YYYY-MM-DD"T"hh24:mi:sstzh:est') APPDATE
FROM
mwo mw
and it returns this error:
ORA-01821: date format not recognized
01821. 00000 - "date format not recognized"
*Cause:
*Action:
I tried
mw.appdate, 'YYYY-MM-DD"T"hh24:mi:sstzh:est' APPDATE
and it adds a column called APPDATE_1 which literally has this string in it: YYYY-MM-DD"T"hh24:mi:sstzh:est
UPDATE: I want to make the query return the re-formatted date. I can't re-insert into the db. I'm trying like is in the answer below, but it's still giving an error.
SELECT
mw.account ACCT,
mw.wono WO,
to_char(mw.appdate, 'YYYY-MM-DD"T"HH24:MI:SSTZH:TZM') AS APPDATE
FROM
mwo mw
ERROR:
ORA-01821: date format not recognized
01821. 00000 - "date format not recognized"
*Cause:
*Action: