PHP code example of tartan / laravel-jalali-date

1. Go to this page and download the library: Download tartan/laravel-jalali-date 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/ */

    

tartan / laravel-jalali-date example snippets


composer 

// aliases
'Zaman' => PhpMonsters\Zaman\Facades\Zaman::class,


// Jalali to Gregraian samples
echo Zaman::jTog('next week');
echo Zaman::jTog('now');
echo Zaman::jTog('1396-06-30 05:30:10');
echo Zaman::jTog ('۱۳۹۱/۱۰/۱۲ ۲۰:۳۰:۵۵', 'yyyy/MM/dd H:m:s', 'fa', 'en', 'Asia/Tehran');

// Gregorian to Jalali samples 
echo Zaman::gToj('2 days ago');
echo Zaman::gToj('2010-10-24 22:50:14');
echo Zaman::gToj('2014-09-21 07:12:54', 'EEEE yyyy/MMMM/dd H:m:s');


// Moment samples
echo Zaman::moment(strtotime('3 hours ago')); // "3 ساعت قبل"
echo Zaman::moment(strtotime('2017-01-02 00:10:20')); // "2 هفته قبل"
echo Zaman::momentEn(1494328806); // "May 2017"
echo Zaman::momentEn(1494334506); // "last month"

// Blade usage example
{{ Zaman::gToj('2011-11-20 19:12:19') }}


sudo apt-get install php-intl

sudo yum -y install php-intl