PHP code example of saleh7 / hijri-dates

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

    

saleh7 / hijri-dates example snippets


	$now = \GeniusTS\HijriDate\Date::now();
	$today = \GeniusTS\HijriDate\Date::today();
	$tomorrow = \GeniusTS\HijriDate\Date::tomorrow();
	$yesterday = \GeniusTS\HijriDate\Date::yesterday();

	$date = \GeniusTS\HijriDate\Hijri::convertToHijri('2017-05-05');

	// This function return a Carbon instance.
	$date = \GeniusTS\HijriDate\Hijri::convertToGregorian(8, 8, 1438);

	use GeniusTS\HijriDate\Date;

	$today = Date::today();

	// use the second parameter to return indian numbers
	echo $today->format('l d F o', Date::INDIAN_NUMBERS);

	\GeniusTS\HijriDate\Hijri::setDefaultAdjustment(1);

	use GeniusTS\HijriDate\Translations\Arabic;

	\GeniusTS\HijriDate\Date::setTranslation(new Arabic);

	\GeniusTS\HijriDate\Date::setToStringFormat('l d F o');

	use GeniusTS\HijriDate\Date;

	Date::setDefaultNumbers(Date::INDIAN_NUMBERS);