PHP code example of biladina / yii2-hijridatetime

1. Go to this page and download the library: Download biladina/yii2-hijridatetime library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

biladina / yii2-hijridatetime example snippets




use biladina\hijridatetime\HijriDateTime;

// Choose Your Format Like 'l ، j F ، Y'
// Y => Hijri Year [1442]
// F => Hijri Month Arabic Name [رمضان]
// j => Hijri Day Number [27]
// l => Arabic Day Name [الجمعة]
// m => Hijri Month Number [09]
// a => 'ص'
// A => 'صباحًا'
// H => Hour
// i => Minutes
// s => Seconds

$hijri = new HijriDateTime();

$hijri->date("H:i A l, d F Y",time()) // formatting is like date function
// will return 16:16 PM Jum'at, 01 Ramadhan 1441

$hijri->GeToHijr(20, 02,  1976)
// will return Array Hijri date[int month, int day, int year]

$hijri->strToHijri("24 April 2020")
// will return a Date in Hijri d-m-Y if not formated
//-------- Or -----------
$hijri->strToHijri("24 April 2020 15:00:00", "l, d F Y H:i A")
// will return a Date in Hijri as formated like Jum'at, 01 Ramadhan 1441 15:00 PM


return [
	'language' => 'id-ID', // 'en-US' for English, 'ar' for Arabic, 'fr' for France, 'id-ID' for Indonesia
]