0

Hello I have The data table in oracle SQL 12c with 2 col one is thetime , and another is theh the data stored in cols are varchar and format like this :

THETIME | THEH
14000207| 1245
14000207| 1230
14000207| 1215
...

which the 14000207 tell is 1400(yyyy) , 02(MM) and 07(dd) and in THEH 12(HH) and 45(mm) I need to convert it to date format with time for better selecting the data but it's a jalali date and Before do that I need converting to Gregorian , so how Can I do that? ps :

the 1400-02-07 equal to 2021-04-27

1 Answer 1

0

Try this one:

ALTER SESSION SET NLS_CALENDAR = 'Persian';

SELECT TO_DATE(THETIME || THEH, 'YYYYMMDDHH24MI')
FROM dual;
1
  • I use this SELECT TO_TIMESTAMP( TO_DATE(THETIME || THEH, 'YYYYMMDDHH24MI' ,'nls_calendar=persian')) AS dt FROM dual and the returned timstamp look like : 27-APR-21 12.00.00.000000000 AM the time isn't work. Commented Apr 27, 2021 at 14:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.