On Mar 7, 5:00 pm, [EMAIL PROTECTED] wrote: > On Mar 7, 4:35 pm, Jeffrey Froman <[EMAIL PROTECTED]> wrote: > > > [EMAIL PROTECTED] wrote: > > > I need > > > something to parse user input for a django app, and it's awesome to be > > > able to write "last monday", "a year ago", or "10pm tuesday" like > > > PHP's strtotime. > > > Django comes with some pretty handy filters for doing this sort of > > formatting. Check out the "date", "now", "timesince" and "timeuntil" > > filters here: > > >http://www.djangoproject.com/documentation/templates/#built-in-filter... > > > Jeffrey > > Very cool - that's definitely handy to know for the output side of > things. I was mostly interested in writing a custom widget for > handling datetime input, 'cause I can't imagine anyone being studious > enough to use the 2008-03-07 12:00:00 format all the time... besides, > it's hard to type! I'd much rather allow for users to just be able to > type "12pm today". > > So much to learn, so little time! > > Jacob
With some acquaintence with the user, a program can even honor, "remind me 'later' to...". Will you assign meanings to weird ambiguities like, 'last February' (No, I mean laaaaaaast February.) if it's April and "tomorrow" if it's 4 a.m.? Just raise an exception: TimeOfDayException: "Yes, but it's 4 a.m." (or, Those probabilities are close.) The vocabulary for referring to time isn't that large. What did I miss? Yesterday, today, tomorrow, ago, from now, later, after, before, [units], [absolutes], wikipedia. But what's the elegant way to structure the expression? -- http://mail.python.org/mailman/listinfo/python-list