note 57637 added to function.strtotime

From: Date: Sun, 09 Oct 2005 20:08:16 +0000
Subject: note 57637 added to function.strtotime
Groups: php.notes 
Request: Send a blank email to php-notes+get-96758@lists.php.net to get a copy of this message
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. ---- Manual Page -- http://www.php.net/manual/en/function.strtotime.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+57637 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+57637&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+57637&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+57637&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+57637&report=yes&reason=useless Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+57637&report=yes&reason=non-english Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+57637&report=yes&reason=already+in+docs Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+57637&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+57637&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#96758) next »