Forum Stats

  • 3,853,184 Users
  • 2,264,189 Discussions
  • 7,905,280 Comments

Discussions

Convert gregorian Date to Hijri Date

3893507
3893507 Member Posts: 13
edited Jul 19, 2019 9:23AM in Oracle JET

I need to convert the gregorian date(2019-01-01) to hijri date in Oracle jet(1440-04-23)

Answers

  • Sven W.
    Sven W. Member Posts: 10,551 Gold Crown
    edited Jul 19, 2019 9:23AM

    Calendar arithmetic is extremly complex.

    Oracle JET is not the tool to provide calendar arithemtic (afaik) - of cause you might want to integrate some other js-framework that can do it.

    I suggest to use something that already has a good implementation. For example you can ask any oracle database to use a date and to prettyprint this date using the Gregorian or one Islamic calendar.

    Here is an example:

    alter session set nls_calendar = 'Gregorian';select to_char(sysdate) today_gregorian from dual;19-07-2019alter session set nls_calendar = 'English Hijrah';select to_char(sysdate) today_islamic from dual;16 Thoul Ki'Dah  1440alter session set nls_calendar = 'Arabic Hijrah';select to_char(sysdate) today_islamic from dual;16 ذو القعدة 1440
  • Sadiq Karegar
    Sadiq Karegar Member Posts: 1 Green Ribbon

     select to_char(sysdate,'DD-MM-YYYYY','nls_calendar=''arabic hijrah''') from dual