Hijri Date Inserting to the Database
-
06-07-2021 - |
문제
In my database, I used gregorian Date. I want to insert hijri date. How can it be done or is there any problem with it. I used hibernate and JPA.
e.g. 2/30/1433 is hijri date. However, february is at most 29 days. In that case, is there any error?
best regards
해결책
I guess the best is convert hijri to gregorian. It is not important to convert correctly, if it can be reconvert to same hijri date.
다른 팁
PostgreSQL stores only Gregorian calendar dates for the modern period in the DATE
, TIMESTAMP WITH TIME ZONE
and TIMESTAMP WITHOUT TIME ZONE
objects. See the documentation for date/time types which states:
Dates are counted according to the Gregorian calendar, even in years before that calendar was introduced (see Section B.4 for more information).
For pre-Gregorian dates see B.4 datetime units history. this mailing list thread may also be useful.
If you want support for calendars other than the Gregorian calendar you need to find a PostgreSQL extension that understands the desired calendar or you need to store the dates as plain text
strings in the DB.