Arexx (66/67)

From:Ash R. J. Wyllie
Date:25 Oct 99 at 14:26:55
Subject:Re: Date

From: ashw@lr.net (Ash R. J. Wyllie)

Excerpted from the mind of Mike Cardwell;

>From: Mike Cardwell <mickeyc@ukonline.co.uk>

>Hi All,

>I need for a part of one of my scripts, something that can figure out
>the number of days between two dates eg 20-Aug-99 and 10-Oct-99 is 21
>days. The dates are in this format, and it must be able to work over a
>few months, and go into different years aswell. I'd appreciate any help
>anyone can give. Thanks.

try this



/* */

one = '20-oct-99'
two = '25-dec-99'

say deltadays(two one) /* note no comma */

exit

days: procedure

months = 'JAN FEB MAR APR MAY JUN JUL AUG SEP OCT NOV DEC'

parse arg day '-' month '-' year

if year < 50 /* y2k compliant */
then year = year + 2000
else year = year + 1900

month = find(months, upper(month))

return date('i', year || right('0'||month,2) || right('0'||day,2), 's' )

deltadays: procedure

parse day2 day1

return days(day2) - days(day1)



-ash
for assistance dial MYCROFTXXX

--------------------------- ONElist Sponsor ----------------------------

??? Computer Questions ==> Free Answers From Live Experts ! ! !
go to EXPERTCITY.COM
<a href=" http://clickme.onelist.com/ad/expertcity15 ">Click Here</a>

------------------------------------------------------------------------
ARexx mailing list - No flames, no overquoting, no crossposting. Unsubscribe: Blank mail to mailto:arexx-unsubscribe@onelist.com