Date Comparison Problems (was Date)
Sivakatirswami
katir at hindu.org
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....
skts
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,
>
>
> TIA
>
>
> Regards
>
> Ian
>
> =======================
> Ian McKnight
>
> iangmcknight at googlemail.com
> =======================
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution
>
--
Om shanti
(In Peace)
Sivakatirswami
www.himalayanacademy.com
Get Hinduism Today Digital Edition. It's Free!
http://www.hinduismtoday.com/digital/
More information about the use-livecode
mailing list