borsaco / jalali-date-time-bundle
A bundle to using jalali date time in Symfony applications
Installs: 13
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 0
Open Issues: 0
Type:symfony-bundle
Requires
- borsaco/jalali-date-time: ^1.0.0
- symfony/framework-bundle: >=2.2
This package is auto-updated.
Last update: 2025-02-18 05:51:12 UTC
README
A bundle to using jlali date time in Symfony applications
Install
Via Composer
composer require borsaco/jalali-date-time-bundle
Edit your app/AppKernel.php to register the bundle in the registerBundles() method as above:
class AppKernel extends Kernel { public function registerBundles() { $bundles = array( // ... // register the bundle here new Borsaco\JalaliDateTimeBundle\JalaliDateTimeBundle() ); } }
Usage
Wherever you have access to the service container :
<?php // 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); ?>
For use the form type add JalaliDateType
form type and create your view with this library:
https://github.com/beygi/bootstrap-persian-datetimepicker