Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Best way to store Hijri dates in mysql?

I am developing a web application using CakePHP and mysql and all the dates in the system use the Islamic/Hijri calendar(http://en.wikipedia.org/wiki/Islamic_calendar) . I was wondering what is the best way to store Hijri dates in mysql?

Note: I already use Keith Wood's jQuery DatePicker(http://keith-wood.name/datepick.html).

like image 292
Ahmed Aman Avatar asked Sep 15 '25 00:09

Ahmed Aman


2 Answers

Actually, you don't have to use any external library . Use the Keith Wood Calendar plugin to convert the Hijri date to timestamp or to Gregorian . Then save it in a normal datetime field in mysql.

it is possible to translate between Hijri and Gregorian on the fly (see http://yse-uk.com/?page_id=13) so you could simply store your dates as Gregorian and convert them before displaying.

like image 26
Colin Pickard Avatar answered Sep 17 '25 14:09

Colin Pickard



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!