Sunday 16th June 2024 | Ahad 9th Dhul-Hijjah 1445 [?]

The Islamic Hijri Date Application Programming Interface (API) used to generate the current Hijri date on our Moon Sighting UK website is based on the actual sighting of the moon by the human eye. It is a unique API of its kind as it is based on the actual visibility of the moon and not on the calculated birth (or non-visibility) of the moon as widely used by many other Websites and Mobile Phone Apps.

It has been recently updated with an API Key for reliability and security purposes. It can be used by any websites and/or Mobile Phone Apps to display the current Hijri Date as shown the header of this website by obtaining an API Key via our Contact Us form or via the Membership Registration form, by requesting it in the comments box.

The documentation below shows how to use the ICOUK Hijri Date API in a number of formats, including HTML, CSS, CSV and JSON. We would highly recommend website designers to use the JSON format as that will be supported in the future, although other formats will continue to work for the time being, unless advised otherwise. It can be used by popular Content Management Systems (CMS), such as Joomla and WordPress, too.

It is very easy to implement on any website, app, software or anything that can read remote data.

The Hijri Date API is here:<32-chars string>
Hijri Date API Usage 1439 Rajab 07

Or for the JSON format, use the version below:<32-chars string>

The JSON data returned format is here:


Using the CSS return method:
The CSS returns a full HTML pre formatted with css class names. You only need to create the css to format it however you want.Hijri Date API Usage 1439 Rajab 07 css

<style type="text/css>
        display: block;
        border: solid 1px #aaa;
        background-color: #f6f6f6;
        padding: 10px;
        text-align: center;
        font-family: Verdana, Geneva, sans-serif;
        width: 150px;
    .islamic_day{ font-size: 11px; line-height: 18px; }
    .islamic_date{ font-weight: bold; color: #777; font-size: 40px; display: block; }
    .islamic_month{ display: block; padding: 5px; }
    .islamic_year{ font-weight: bold; }
    .greg_date_container{ display: none; } /* We'll just ignore the gregorian date */
</style><32-chars string>

Using JSON to format in PHP:

$json = file_get_contents("<32-chars string>");
	$hijri_data = json_decode($json, true);
	$islamic_day = $hijri_data['islamic'][0];
	$islamic_date = $hijri_data['islamic'][1];
	$islamic_month = $hijri_data['islamic'][2];
	$islamic_year = $hijri_data['islamic'][3];
	//do as you wish here with the date (example on next line)
	echo "$islamic_day $islamic_date $islamic_month $islamic_year";

For other formats (HTML, CSV, CSS), replace the return parameter according as shown below:
hijri.php?return=html; hijri.php?return=csv; hijri.php?return=css

If you wish to check a future Hijri date for test purposes, then use the date parameter as shown below:<32-chars string>

The data returned format is here:


Note that a separate Hijri Calendar API is also available using a similar API Key method.

The Hijri Calendar API is here:<32-chars string>

The data returned format is here:Hijri Date API Usage Shawwal 1438


By using the above Hijri Months start date and the Arabic Names of the months (e.g. from Islamic Calendar on Wikipedia) it is possible to produce monthly calendar shown on the Home Page of the Moon Sighting UK website.

Website developers must ensure that the API Key supplied to them are only used for the intended website and hidden from the View [Page] Source using server-side scripting. An example PHP code for including in the header template/theme of Joomal/Wordpress websites is given below:

  $json_url = "<2-chars>&apikey=<32-chars string>;
  $html = file_get_contents($json_url);
  echo $html;

Note that the default country for the ICOUK Hijri Date API is for the UK (country=GB), although we have received requests to add additional API for a few other countries.

Related: ICOUK Hijri Calendar Widgets

If you have any comments or questions regarding this article, please do not hesitate to email us via our on-line Contact Us form.