Skip to content

Parse .Net JSON dates to DateTime object, and convert DateTime object to .Net JSON date format.

License

Notifications You must be signed in to change notification settings

webapix/dot-net-json-date-formatter

Repository files navigation

Dotnet JSON date

Tests MIT Licensed

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.

About

Parse .Net JSON dates to DateTime object, and convert DateTime object to .Net JSON date format.

Topics

Resources

License

Stars

Watchers

Forks

Sponsor this project

Packages

No packages published

Languages