PHP code example of borsaco / jalali-date-time-bundle

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

    

borsaco / jalali-date-time-bundle example snippets


class AppKernel extends Kernel
{

    public function registerBundles()
    {
        $bundles = array(
            // ...
            // register the bundle here
            new Borsaco\JalaliDateTimeBundle\JalaliDateTimeBundle()
        );
    }
}


    // get the jlali date as a service
    $jlaliDateTime = $this->container->get('jalali_date_time');

    $jlaliDateTime->date('l j F Y H:i');
    $jlaliDateTime->date('Y-m-d', false, false);
    $jlaliDateTime->date('Y-m-d', false, false, false);
    $jlaliDateTime->date("l j F Y H:i T", false, null, null, 'America/New_York');
    
    // convert to jalali
    $unixDatetime = date("U");
    $jlaliDateTime->date('l j F Y H:i', $unixDatetime);