PHP code example of zein / hijri

1. Go to this page and download the library: Download zein/hijri 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/ */

    

zein / hijri example snippets



Zein\Hijri\Hijri;

echo Hijri::now(); // get current date in hijri
// output : 09 Dzul Qa'dah 1443

echo Hijri::yesterday(); // yesterday
// output : 08 Dzul Qa'dah 1443

echo Hijri::yesterday(); // tomorrow
// output : 10 Dzul Qa'dah 1443

echo Hijri::now()->format('Y-m-d'); // tomorrow
// output : 1443-11-09

echo Hijri::get(15)->day()->ago(); // get 15 day ago
echo Hijri::get(1)->month()->ago(); // get 1 month ago
echo Hijri::get(2)->year()->ago(); // get 2 year ago