Bug #51866 - lenient date parsing

From: Date: Sun, 23 May 2010 08:52:47 +0000
Subject: Bug #51866 - lenient date parsing
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-48407@lists.php.net to get a copy of this message
Hi! The bug 51866 was reclassified as docs bug, but I still think it makes a lot of sense to allow for lenient date parsing. And it's quite easy to do IMHO - the parser can easily stop at the end of the data or format it needed and not treat it as an error. And it would help working with user date/time inputs where parts can be missing and format it not known to the code (i.e. user-defined). Since with user-specified format it's hard to know what is missing without actually parsing the date, so making code that can parse both date+time and just date (assuming, for example, midnight of the same date) is a lot harder than it should be. So, I propose making some option that would allow the parser to parse strings that have less or more data than the pattern requires. It may be implemented either as format character (I'd suggest ? at the end) or as an optional parameter. What do you think? -- Stanislav Malyshev, Software Architect SugarCRM: http://www.sugarcrm.com/ (408)454-6900 ext. 227

« previous php.internals (#48407) next »