Arexx (40/67)

From:Neil Bothwick
Date:20 Oct 99 at 16:47:13
Subject:Re: Date

From: "Neil Bothwick" <neil@wire.net.uk>

Mike Cardwell said,

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

Here's what the readme says on thew date() function. Your example could
be calculated with

date(B,19991010,S) - date(B,19990820,S)

DATE()
Usage: DATE([option],[date],[format])
Returns the current date in the specified format. The default ('Normal')
option returns the date in the form DD MMM YYYY, as in 20 Apr 1988.
The options recognized are:
Basedate -- the number of days since January 1, 0001
Century -- the number of days since January 1 of the century
Days -- the number of days since January 1 of the current year
European -- the date in the form DD/MM/YY
Internal -- internal system days
Julian -- the date in the form YYDDD
Month -- the current month (in mixed case)
Normal -- the date in the form DD MMM YYYY
Ordered -- the date in the form YY/MM/DD
Sorted -- the date in the form YYYYMMDD
USA -- the date in the form MM/DD/YY
Weekday -- the day of the week (in mixed case)
These options can be shortened to just the first character.

In addition, the DATE() function now accepts optional second and third
arguments to supply the date either in the form of internal system days
or in the 'sorted' form YYYYMMDD. The second argument is an integer
specifying either system days (the default) or a sorted date; the third
argument specifies the form of the date and can be either 'I' or 'S'.
The current date in system days can be retrieved using DATE('Internal').

Examples:
say date() ==> 20 Apr 1988
say date('M') ==> April
say date(s) ==> 19880420
say date('s',date('i')+21) ==> 19890609
say date('w',19890609,'S') ==> Friday

Neil



Neil Bothwick - New Media Editor, Amiga Active Magazine
Connected via Wirenet, The UK's first Amiga-only internet access provider
http://www.wire.net.uk


Time for a diet! -- [NO FLABBIER].

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