Closed (fixed)
Project:
Date
Version:
5.x-2.x-dev
Component:
Date API
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
12 Mar 2008 at 19:31 UTC
Updated:
20 Mar 2008 at 14:52 UTC
I like the new cleaner date_make_date() function.
Is there any functionality exposed in the API (or intended to be) to do string to time guessing for those occasions where it's not matching any of the available REGEX?
aside
As I type it occurs to me one of the occasions where I want to parse dates not matching a present regex is when they are in RFC822(2) date format which I believe match these (according to the python source of the feedvalidator.org):
rfc822_re = re.compile("(((mon)|(tue)|(wed)|(thu)|(fri)|(sat)|(sun))\s*,\s*)?" +
"\d\d?\s+((jan)|(feb)|(mar)|(apr)|(may)|(jun)|(jul)|(aug)|(sep)|(oct)|" +
"(nov)|(dec))\s+\d\d(\d\d)?\s+\d\d:\d\d(:\d\d)?\s+(([+-]\d\d\d\d)|" +
"(ut)|(gmt)|(est)|(edt)|(cst)|(cdt)|(mst)|(mdt)|(pst)|(pdt)|[a-ik-z])?$",
re.UNICODE)
rfc2822_re = re.compile("(((Mon)|(Tue)|(Wed)|(Thu)|(Fri)|(Sat)|(Sun)), )?" +
"\d\d? ((Jan)|(Feb)|(Mar)|(Apr)|(May)|(Jun)|(Jul)|(Aug)|(Sep)|(Oct)|" +
"(Nov)|(Dec)) \d\d\d\d \d\d:\d\d(:\d\d)? (([+-]?\d\d[03]0)|" +
"(UT)|(GMT)|(EST)|(EDT)|(CST)|(CDT)|(MST)|(MDT)|(PST)|(PDT)|Z)$")
Comments
Comment #1
ekes commentedAnswer is now there is now a php datetime object made using php5's http://php.net/date_create and php4 version of it with the module.