NYCPHP Meetup

NYPHP.org

[nycphp-talk] handling vague dates.

Hans Zaunere hans at nyphp.org
Wed Oct 1 13:40:26 EDT 2003



David Vogel wrote:

> Hey,
> 
> I have a small batch of dates that I'd like to get into a db.  Almost
> all of them are specific, eg October 1.  However, a few refer to things
> that happen around a certain time.  For example students' "Housing bill
> for spring semester due" is listed as 'Early January'.
> 
> So, I'm not sure how to set up the db to accomodate the oddballs.  Any
> suggestions would be much appreciated.

I've dealt with almost the same thing.  Very often, patients will say "I was sick in March" or "I came down with xyz in 1970".

I wrote http://pcomd.net/Ymd to handle these types of things (you can just download/copy the source without worrying about the pCom part of it) and it's worked great.  While the code is tuned for MySQL the premise remains the same for any DB; use ISO dates, which have no problem being ambiguous and are super fast/portable (they're just ints).  The only items I see that Ymd wouldn't address for you is stating "early xyz...", and they require at least a year to be used (although these could be hacked out).

HTH,

H





More information about the talk mailing list