PHP code example of maherelgamil / arabicdatetime

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

    

maherelgamil / arabicdatetime example snippets


	...
	Maherelgamil\Arabicdatetime\ArabicdatetimeServiceProvider::class
	...

	...
	'Arabicdatetime'    => Maherelgamil\Arabicdatetime\Facades\Arabicdatetime::class
	...


    //$arabDateTime->date({unixtime} , {mode} , {schema} , {numericMode});

    //This function take 4 Parameters :

    //1- unixtime : ex '1418123530'

    //2- mode :
        0 for Arabic date
        1 for Hijri date

    //3- schema : as `php` schema , you can read this page for more info. : http://php.net/manual/en/function.date.php

    //4- numericMode takes two types 'indian'  or 'arabic' and 'arabic' is default

    //5 - Create a Arabicdatetime instance
    $arabDateTime = new Arabicdatetime();

    //for Gregorian date with Englsih numbers
    $arabDateTime->date(1418123530 , 0);

    //for Hijri date with indian numbers
    $arabDateTime->date(1418123530 , 1 , 'd / m / y '  ,'indian');

    //for Hijri date, there is an optional correction, You can add or subtract days with plus and minus
    $arabDateTime->setCorrection('+1');
    $arabDateTime->setCorrection('-1');


    $arabDateTime->getDays();

    $arabDateTime->getArabicDays();

    $arabDateTime->getMonths();

    $arabDateTime->getArabicMonths();

    $arabDateTime->getHijriMonths();

    $arabDateTime->getArabicHijriMonths();

    $arabDateTime->remainingTime(1418123530);

    $arabDateTime->leftTime(1418123530);

    $arabDateTime->leftRemainingTime(1418123530);

    php artisan vendor:publish