https://github.com/borsaco/jalalidatetimebundle
A bundle to using jalali date time in Symfony applications
https://github.com/borsaco/jalalidatetimebundle
Last synced: 5 months ago
JSON representation
A bundle to using jalali date time in Symfony applications
- Host: GitHub
- URL: https://github.com/borsaco/jalalidatetimebundle
- Owner: borsaco
- License: bsd-3-clause
- Created: 2019-07-09T06:46:04.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2020-04-17T19:25:29.000Z (about 6 years ago)
- Last Synced: 2025-07-22T17:47:45.061Z (11 months ago)
- Language: PHP
- Size: 12.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# JalaliDateTimeBundle
A bundle to using jlali date time in Symfony applications
## Install
Via Composer
``` bash
composer require borsaco/jalali-date-time-bundle
```
Edit your app/AppKernel.php to register the bundle in the registerBundles() method as above:
```php
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
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