Date Comparison Problems (was Date)

Sivakatirswami katir at
Sun Sep 10 05:26:07 EDT 2006

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....


Ian McKnight wrote:
> Hi
> I have a stack which calls for a date to be entered.
> As part of the validation checks I split the date into an array.
> Once the date has been validated I then want to ensure that it is not
> in the future.
> So I compare the valid input date with the current date.
> The straight comparison code of
> if theDOB > theDateNow then .....
> failed so the code I use is converts both dates to seconds
> -- check if date is in the future
> put theDOBA into theDOB
> combine theDOB with "/"
> convert theDOB to short date -- to ensure that it is treated as a
> date - seems to make no difference
> convert theDOB to seconds --------- fails here
> theDOBA is an array containing a date in the form DD MM YYYY - one
> element per key
> When I enter a date eg "19/3/1984" the variable theDOB is not
> cenverted but remains in date form, however this code to convert the
> current date to seconds works fine
> put the short date into theDateNow
> set itemdelimiter to "/"
> put 20 before item 3 of theDateNow -- ensure 4 digit year
> convert theDateNow to seconds
> I would appreciate any guidance as my reassembled date does not seem
> to be treated as a date,
> Regards
> Ian
> =======================
> Ian McKnight
> iangmcknight at
> =======================
> _______________________________________________
> use-revolution mailing list
> use-revolution at
> Please visit this url to subscribe, unsubscribe and manage your 
> subscription preferences:

Om shanti
(In  Peace)


Get Hinduism Today Digital Edition. It's Free!

More information about the Use-livecode mailing list