Edit report at https://bugs.php.net/bug.php?id=34797&edit=1

 ID:                 34797
 Updated by:         ras...@php.net
 Reported by:        saverio dot caminiti at alfanet dot it
 Summary:            strtotime() and strtointerval()
-Status:             Open
+Status:             Closed
 Type:               Feature/Change Request
-Package:            Feature/Change Request
+Package:            *General Issues
 Operating System:   Irrelevant
 PHP Version:        5.0.5
-Assigned To:        
+Assigned To:        rasmus
 Block user comment: N
 Private report:     N

 New Comment:

We now have DatePeriod and DateInterval which, although isn't quite the same 
thing as this request, I think is quite a bit more useful as it lets you 
iterate 
using the interval across the period. And you can use strtotime() syntax to 
define the end points of the period to iterate over.


Previous Comments:
------------------------------------------------------------------------
[2005-10-09 23:17:21] saverio dot caminiti at alfanet dot it

Description:
------------
The function strtotime() 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().

I guess that 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.




------------------------------------------------------------------------



-- 
Edit this bug report at https://bugs.php.net/bug.php?id=34797&edit=1

Reply via email to