webapix / dot-net-json-date-formatter
Convert .net json date format to PHP DateTime object and vica versa
Fund package maintenance!
patrons.webapix.hu
Installs: 84 734
Dependents: 1
Suggesters: 0
Security: 0
Stars: 7
Watchers: 3
Forks: 2
Open Issues: 0
Requires
- php: >=5.6
Requires (Dev)
- phpunit/phpunit: 5.7.27|^6|^7|8.5.22
This package is auto-updated.
Last update: 2024-12-30 12:13:31 UTC
README
Parse .Net JSON dates to DateTime object, and convert DateTime object to .Net JSON date format.
Installation
You can install the package via composer:
composer require webapix/dot-net-json-date-formatter
Usage
To parse .NET JSON dates:
use \Webapix\DotNetJsonDate\Date; Date::toDateTime('/Date(1593432000000+0200)/'); // return with \DateTime object
If the Json string is invalid, it will throw an \Webapix\DotNetJsonDate\InvalidJsonDateString exception.
To convert DateTime to JSON date:
use \Webapix\DotNetJsonDate\Date; $dateTime = DateTime::createFromFormat('Y-m-d H:i:s', '2020-06-29 12:00:00'); Date::toJsonDate($dateTime); // return with: /Date(1593432000000+0000)/
Testing
composer test
Postcardware
According to the postcardware concept, if you use the software for your project(s) we would appreciate to receive a postcard of your hometown.
Please send it to:
WEBAPIX KFT.
Kőris utca 2/E, 2/1
2051 Biatorbágy
Hungary
Support us
If you find our packages useful and would like to support our work in maintaining and regularly updating them, consider becoming a patron. Any size of donation is welcome and highly appreciated.
Contributing
Contributions are welcome! When contributing to this repository, please first discuss the change you wish to make via issue, email, or any other method with the owners of this repository before making a change.
Changelog
Please see CHANGELOG for more information on what has changed recently.
Security
If you discover any security related issues, please email pdo@webapix.hu instead of using the issue tracker.
Credits
License
The MIT License (MIT). Please see License File for more information.