setting date using a slash (/)

Bill Campbell bill at celestial.com
Fri Jun 12 10:08:17 PDT 2009


On Fri, Jun 12, 2009, Nancy Palmquist wrote:
....
>Your suggestion is also a good way to collect dates if various formats 
>and make them all the same format. 
>
>By taking a date typed whichever way, and applying edits until you hit 
>one that passes and makes a legal date you can allow things like:
>
>20090101 and 01012009 in the same field and tell which format the client 
>used.  Then make it into the one you want with an edit.

I did something similar to this when writing date processing
routines that I use in may applications, extending it a bit
though.  It allows entry like 1012009, but also allows entering
smaller decimal numbers treating them as days relative to the
current date (e.g. 30 is treated as 30 days in the future).

I find these very handy in many cases where I want to call
somebody in a week, make a payment a month from now etc. without
having to look at a calendar.

There are a number of FOSS routines such as the python datetime
modules that also accept text such as ``tommorrow'' and even some
rather free-form ways of expressing dates (that I don't use so
can't expound on the options).

Bill
-- 
INTERNET:   bill at celestial.com  Bill Campbell; Celestial Software LLC
URL: http://www.celestial.com/  PO Box 820; 6641 E. Mercer Way
Voice:          (206) 236-1676  Mercer Island, WA 98040-0820
Fax:            (206) 232-9186  Skype: jwccsllc (206) 855-5792

Many citizens because of their respect for what only appears to be a law
are cunningly coerced into waiving their rights due to ignorance.
    -- U.S. v. Minker


More information about the Filepro-list mailing list