From:             saverio dot caminiti at alfanet dot it
Operating system: Irrelevant
PHP version:      5.0.5
PHP Bug Type:     Feature/Change Request
Bug description:  strtotime() and strtointerval()

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 bug report at http://bugs.php.net/?id=34797&edit=1
-- 
Try a CVS snapshot (php4):   http://bugs.php.net/fix.php?id=34797&r=trysnapshot4
Try a CVS snapshot (php5.0): 
http://bugs.php.net/fix.php?id=34797&r=trysnapshot50
Try a CVS snapshot (php5.1): 
http://bugs.php.net/fix.php?id=34797&r=trysnapshot51
Fixed in CVS:                http://bugs.php.net/fix.php?id=34797&r=fixedcvs
Fixed in release:            http://bugs.php.net/fix.php?id=34797&r=alreadyfixed
Need backtrace:              http://bugs.php.net/fix.php?id=34797&r=needtrace
Need Reproduce Script:       http://bugs.php.net/fix.php?id=34797&r=needscript
Try newer version:           http://bugs.php.net/fix.php?id=34797&r=oldversion
Not developer issue:         http://bugs.php.net/fix.php?id=34797&r=support
Expected behavior:           http://bugs.php.net/fix.php?id=34797&r=notwrong
Not enough info:             
http://bugs.php.net/fix.php?id=34797&r=notenoughinfo
Submitted twice:             
http://bugs.php.net/fix.php?id=34797&r=submittedtwice
register_globals:            http://bugs.php.net/fix.php?id=34797&r=globals
PHP 3 support discontinued:  http://bugs.php.net/fix.php?id=34797&r=php3
Daylight Savings:            http://bugs.php.net/fix.php?id=34797&r=dst
IIS Stability:               http://bugs.php.net/fix.php?id=34797&r=isapi
Install GNU Sed:             http://bugs.php.net/fix.php?id=34797&r=gnused
Floating point limitations:  http://bugs.php.net/fix.php?id=34797&r=float
No Zend Extensions:          http://bugs.php.net/fix.php?id=34797&r=nozend
MySQL Configuration Error:   http://bugs.php.net/fix.php?id=34797&r=mysqlcfg

Reply via email to