I am working on a project that has a form which requires the user to input a date using the Hijri (Arabic) calendar. I am only familiar with Javascript datepickers for the Gregorian calendar.
I searched a lot on the internet and the closest I got was JS code for the Persian calendar, which is in Arabic, but everything else is different. For example the names of the days, months etc. And the Persian calendar is based on the solar calendar.
Anyway, please advise on what I can do.
Thanks.
You have to use a library/class do that conversion job for you, one of the available options is what Ar-PHP library provides (it is free open source library published under LGPL license), please find below an example code:
date_default_timezone_set('UTC');
$time = time();
require('I18N/Arabic.php');
$obj = new I18N_Arabic('Date');
$fix = $obj->dateCorrection ($time);
echo $obj->date('l dS F Y h:i:s A', $time, $fix);
You can find a life example and check the output here
More information about how calculation itself done can be found here
The Arabic PHP Project may help you with PHP.
http://www.ar-php.org/features-php-arabic.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With