String to time

From: Date: Mon, 12 Jul 1999 00:48:01 +0000
Subject: String to time
Groups: php.dev 
Request: Send a blank email to php-dev+get-8370@lists.php.net to get a copy of this message
I have just finished another loadable function. This one is an interface to a routine I swiped out of C-news a long time ago. It's a YACC thing called 'getdate'. You give it a free form date string and it turns it into a time_t. It also accepts offset style date input, such as "now + 1 minute". It takes as input a time value to be used as the base for such relative time strings. My strtotime() function takes either 1 or 2 arguments. The first is the string, the second is an optional timeval (the default is the current time if this argument is left out). It returns a timeval, or -1 if the input specifies an illegal time (years must be 1970-2099, the way I compiled it. As it was in C-news, years beyond 2000 didn't work, but the fix was simple). I can provide it to anyone who is interested. I didn't find a similar function in the manual (at least one whose input was as free-form). If it exists, then tell me and watch me turn beet red. :-)

« previous php.dev (#8370) next »