Date Comparison Problems (was Date)
iangmcknight at googlemail.com
Sun Sep 10 16:29:35 CDT 2006
On 10/09/06, Sivakatirswami <katir at hindu.org> wrote:
> Just curious... instead of an array...might the dateitems function
> (which I use a lot) be more intuitive-helpful?
> wherein the order of items is fixed unlike the array hash order?
> After validation,
> convert tDOB to dateitems
> # keep it stored as dateitems list
> # access items as needed for YYYY, MM, DD
> # future test:
> if DateAsSeconds(tDOB) > DateAsSeconds(the date) then
> answer "That's the future!" with "Oops, try again..."
> exit to top
> end if
> function DateAsSeconds tDate
> convert tDate to seconds
> return tDate
> end DateAsSeconds
> I've just used dateitems for so long
> I think I have it memorized
> year: item 1 of tDOB etc.
> not as "cool" or terse as using arrays,
> but more transparent. Of course, maybe you have good reason for
> using an array....
I was experimenting with a simple way to validate a date and hit upon
arrays as a way of confirming the number of days in a month - use an
array containing the days of the month and reference those by the
month number. Use of arrays just spiraled from there. The humourous
aspect, for me, in all this, is that after writing many lines of code
to achieve a valid date it seems all I needed to do was code
if theDOB is a date. Isn't Revolution wonderful! Back to the drawing
board. And thanks for the advice.
More information about the use-livecode