E and F are the correct answers: tested and confirmed:
SELECT TO_DATE(TO_CHAR(SYSDATE, 'MM/DD/YYYY'), 'MM/DD/YYYY') FROM DUAL;
SELECT TO_CHAR(ADD_MONTHS(SYSDATE, 6), 'dd-mon-yyyy') FROM DUAL;
E & B will show year forma in 4 digits only if you consider B has no typing error..the string has to be quoted. SELECT TO_CHAR(SYSDATE, 'MM/DD/YYYY') FROM DUAL;
In answer it is written MM/DD/YYYY without quotes.
Weird.
Imported all in to Oracle apex and got the following results:
SELECT TO_DATE(SYSDATE, 'RRRR-MM-DD') FROM DUAL; ---- ORA-01843: not a valid month
SELECT TO_CHAR(SYSDATE, MM/DD/YYYY) FROM DUAL; ----- Error at line 1/31: ORA-00904: "YYYY": invalid identifier. This answer is missing single quotes around the format, otherwise it would be correct.
SELECT TO_DATE(ADD_MONTHS(SYSDATE, 6), 'dd-mon-yyyy') FROM DUAL; ------ ORA-01843: not a valid month
SELECT TO_CHAR(ADD_MONTHS(SYSDATE, 6)) FROM DUAL; ------ 09/15/2023 and thus is correct.
SELECT TO_CHAR(ADD_MONTHS(SYSDATE, 6), 'dd-mon-yyyy') FROM DUAL; ------ 15-sep-2023 and thus is also correct.
SELECT TO_DATE(TO_CHAR(SYSDATE, 'MM/DD/YYYY'), 'MM/DD/YYYY') FROM DUAL; ------- 03/15/2023 and thus is also correct?|
This question is just a mess...
A voting comment increases the vote count for the chosen answer by one.
Upvoting a comment with a selected answer will also increase the vote count towards that answer by one.
So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.
Thameur01
6 days, 11 hours agosalander71
3 months, 1 week agoShahedOdeh
3 months, 3 weeks agoArslanAltaf
7 months, 1 week agoogi33
9 months, 1 week agohmatinnn
10 months, 3 weeks agodeepzsiva
12 months agolucemqy
1 year, 1 month agojm9999
1 year, 3 months agozouve
1 year, 6 months agoCecilia_Soso
1 year, 8 months agoMooonLight
1 year, 8 months agoRik92
1 year, 10 months agoogi33
9 months, 1 week agoyanoolthecool
1 year agokesammy9
1 year, 10 months agojfc1
1 year, 11 months agocadcadley
2 years agoBabi265
2 years, 1 month ago