PHP code example of irpug / facal

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

    

irpug / facal example snippets

 php
ini_set('intl.default_locale', 'fa_IR');

UG\FaCal\Lib\PersianCarbon;
use IrPUG\FaCal\FaCalUtils;

$date = new PersianDateTime();
$date->setPersianDate(1394, 2, 2);

var_dump($date);


var_dump(FaCalUtils::printDateTime($date, FaCalUtils::FULL));
var_dump(FaCalUtils::printDateTime($date, FaCalUtils::SHORT));
var_dump(FaCalUtils::printDateTime($date, FaCalUtils::NONE));
var_dump(FaCalUtils::printDateTime($date, FaCalUtils::LONG));
var_dump(FaCalUtils::printDateTime($date, FaCalUtils::MEDIUM));
var_dump(FaCalUtils::printDateTime($date, "EEEE, d 'of' MMMM y"));
var_dump(FaCalUtils::getYear($date));
var_dump(FaCalUtils::getMonthNum($date));
var_dump(FaCalUtils::getMonthName($date));
var_dump(FaCalUtils::getWeekdayName($date));
var_dump(FaCalUtils::getWeekdayNum($date));
var_dump(FaCalUtils::getQuarter($date));

var_dump(PersianCarbon::createFromPersianDate(1394, 1, 1)->addDay());
var_dump(FaCalUtils::printDateTime(PersianCarbon::createFromPersianDate(1394, 1, 1)->addDay(), FaCalUtils::FULL));
var_dump(PersianCarbon::createFromPersianDate(1393, 12, 28)->diffForHumans());