note 57637 deleted from function.strtotime by derick
| From: | derick@php.net | Date: | Sun, 15 Jul 2007 12:45:48 +0000 |
| Subject: | note 57637 deleted from function.strtotime by derick | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-128573@lists.php.net to get a copy of this message | ||
Note Submitter: saverio dot caminiti at alfanet dot it
----
This function is really useful.
But it always returns the minimum timestamp that match the input string. It should be even more
useful to have a function strtointerval that return a two timestamps: the minimum timestamp that
match the input and the maximum one.
For example:
- strtointerval(Dec 3 2004) should returns a minimum timestamp (0:0:0 Dec 3 2004) and a maximum
one (23:59:59 Dec 3 2004).
- strtointerval(Dec 2004) returns 0:0:0 Dec 1 2004 and 23:59:59 Dec 31 2004
- strtointerval(2004) returns 0:0:0 Jan 1 2004 and 23:59:59 Dec 31 2004
And so on.
It should be also useful that strtointerval() parse English sentences like between A and B or
[form] A to B where A and B are two valid input for the actual strtotime().
Starting from the source code of strtotime() it should be not difficult to implement
strtointerval(), perhaps through a function strtoMAXtime() that generate the maximum timestamp
instead of the minimum one, and then adding the English interval sentences support.
Thanks,
Saverio Caminiti.