Question

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

Was it helpful?

Solution

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.

OTHER TIPS

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top