11# PHP Date Parser
22
3- This library parses various given date and time strings into
4- DateTime or DateTimeImmutable classes which return the time
5- range. Can be used e.g. excellently for command line
6- arguments and options to make database queries with.
3+ [ ![ Release] ( https://img.shields.io/github/v/release/ixnode/php-date-parser )] ( https://github.com/ixnode/php-date-parser/releases )
4+ [ ![ PHP] ( https://img.shields.io/badge/PHP-^8.2-777bb3.svg?logo=php&logoColor=white&labelColor=555555&style=flat )] ( https://www.php.net/supported-versions.php )
5+ [ ![ PHPStan] ( https://img.shields.io/badge/PHPStan-Level%20Max-brightgreen.svg?style=flat )] ( https://phpstan.org/user-guide/rule-levels )
6+ [ ![ PHPCS] ( https://img.shields.io/badge/PHPCS-PSR12-brightgreen.svg?style=flat )] ( https://www.php-fig.org/psr/psr-12/ )
7+ [ ![ LICENSE] ( https://img.shields.io/github/license/ixnode/php-api-version-bundle )] ( https://github.com/ixnode/php-api-version-bundle/blob/master/LICENSE )
8+
9+ > This library parses various given date and time strings into
10+ > DateTime or DateTimeImmutable classes which return the time
11+ > range. Can be used e.g. excellently for command line
12+ > arguments and options to make database queries with.
713
814## Examples / Usage
915
@@ -132,6 +138,9 @@ print $dateRange->getTo()?->format('Y-m-d H:i:s (e)');
132138| <nobr>`">+2023-07-01"`</nobr> | Alias of `">=2023-07-01"` | <nobr>`"2023-07-01 00:00:00"`</nobr> | <nobr>`NULL`</nobr> |
133139| <nobr>`"+2023-07-01"`</nobr> | Alias of `">=2023-07-01"` | <nobr>`"2023-07-01 00:00:00"`</nobr> | <nobr>`NULL`</nobr> |
134140
141+ * <sup>1)</sup> - excluding the given one
142+ * <sup>2)</sup> - including the given one
143+ *
135144#### Time is less than parser (`<to`)
136145
137146* Imagine that now is the time: `2023-07-07 12:34:56`
@@ -156,6 +165,9 @@ print $dateRange->getTo()?->format('Y-m-d H:i:s (e)');
156165| <nobr>`"<+2023-07-01"`</nobr> | Alias of `"<=2023-07-01"` | <nobr>`NULL`</nobr> | <nobr>`"2023-07-01 23:59:59"`</nobr> |
157166| <nobr>`"-2023-07-01"`</nobr> | Alias of `"<=2023-07-01"` | <nobr>`NULL`</nobr> | <nobr>`"2023-07-01 23:59:59"`</nobr> |
158167
168+ * <sup>1)</sup> - excluding the given one
169+ * <sup>2)</sup> - including the given one
170+
159171#### Range parser (`from|to`)
160172
161173* Imagine that now is the time: `2023-07-07 12:34:56`
@@ -176,9 +188,6 @@ print $dateRange->getTo()?->format('Y-m-d H:i:s (e)');
176188|-----------------------------------------|---------------------------------------------------------|--------------------------------------|--------------------------------------|
177189| <nobr>`NULL`</nobr> | No range given (infinitive range). | <nobr>`NULL`</nobr> | <nobr>`NULL`</nobr> |
178190
179- * <sup>1)</sup> - excluding the given one
180- * <sup>2)</sup> - including the given one
181-
182191## Methods
183192
184193### Class `DateParser`
0 commit comments