org_heigl / pdo_timezone_helper
Helper for timezone-handling in databases
Installs: 1 106
Dependents: 0
Suggesters: 0
Security: 0
Stars: 2
Watchers: 3
Forks: 0
Open Issues: 2
Type:lib
Requires (Dev)
- phpunit/dbunit: ^2.0
- phpunit/phpunit: ^5.5
This package is auto-updated.
Last update: 2024-11-29 04:36:06 UTC
README
A small library to ease handling of timezones with PDO
Usage
This lib provides a helper that creates database-specific code to get a UTC-datetime from a DateTime-Entry and a timezone entry in your table.
You can store your datetimes in the database with or without an offset but with a timezone and this helper will create a UTC-Datetime from it for comparisons
$helper = new PdoTimezoneHelper::create($pdoObject); $helper->setTimezoneField($field); echo sprintf( "SELECT * FROM table WHERE %1$s < '2016-12-31T23:59:59'", $helper->getUtcDateTime($dateTimeField);
Installation
This lib is best installed using composer:
composer require org_heigl/pdo_timezone_helper