assistenzde / database-timezone
Unified database time zone values
Installs: 55
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 0
Open Issues: 0
Type:symfony-bundle
Requires
- php: ^7.4 || ^8.0
- doctrine/dbal: ^2.9
Requires (Dev)
- dama/doctrine-test-bundle: ^6.4
- phpunit/phpunit: ^9.4
- symfony/browser-kit: ^5.1
- symfony/yaml: ^5.1
README
The Database Timezone bundle contains method to save dates and datetimes values/objects always in the same (custom) timezone in database. This results in an easier datetime/date handling when accessing database values directly or via PHP.
Quick example usage:
Always save dates/times in UTC timezone in database. Change the configuration of /config/packages/database_timezone.yaml
to:
database_timezone: database: UTC
Table of Contents
Requirements
The usage of PHP ≥ v7.4 and Symfony ≥ 5 is recommended.
Installation
Please install via composer.
composer require assistenzde/database-timezone
The bundle will be automatically added to your bundles.yaml
configuration.
Symfony Configuration
Please add a database_timezone.yaml
file in your configuration directory (i.e. /config/pakcages/) and spcify the timezone to save all datatime values in the database.
database_timezone: database: UTC
Usage
All database values will be saved in the configured timezone.