DATES

date and time utilities

  calendar        calendar for year [months]
  getdate         get date from character string
  todate          convert to date
  todayno         convert to day number
  tsdiff          differences between dates
  tsrep           timestamp as a single number
  tstamp          formatted timestamp
  valdate         validate dates
  weekday         weekday from date

Defined items
NameClassDescription
calendarVerbcalendar for year [months]
getdateVerbget date from character string
todateVerbconverts day numbers to dates
todaynoVerbconverts dates to day numbers
tsdiffVerbdifferences between pairs of dates.
tsrepVerbtimestamp representation as a single number
tstampVerbformat time stamp as: 23 May 1998 16:06:39
valdateVerbvalidate dates
weekdayVerbreturns weekday from date, 0=Sunday ... 6=Saturday

calendar............ (v) calendar for year [months]

returns calendar for year, as a 12 element list

argument is one or more numbers: year, months
If no months are given, it defaults to all months.

example:
   calendar 1998 5 6
+---------------------+---------------------+
|         May         |         Jun         |
| Su Mo Tu We Th Fr Sa| Su Mo Tu We Th Fr Sa|
|                 1  2|     1  2  3  4  5  6|
|  3  4  5  6  7  8  9|  7  8  9 10 11 12 13|
| 10 11 12 13 14 15 16| 14 15 16 17 18 19 20|
| 17 18 19 20 21 22 23| 21 22 23 24 25 26 27|
| 24 25 26 27 28 29 30| 28 29 30            |
| 31                  |                     |
+---------------------+---------------------+

getdate............. (v) get date from character string

form: [opt] getdate string

useful for input forms that have a date entry field

date forms permitted:
    1986 5 23
    May 23 1986
    23 May 1986
and:
  opt=0  (days first - default)
    23 5 1986
  opt=1  (months first)
    5 23 1986

other characters allowed:  ,-/:

if not given, century defaults to current

only first 3 characters of month are tested.

examples:  23/5/86; may 23, 1986; 1986-5-23

requires: valdate

todate.............. (v) converts day numbers to dates

converts day numbers to dates, converse <todayno>

This conversion is exact and provides a means of
performing exact date arithmetic.

y. = day numbers
x. = optional:
  0 - result in form <yyyy mm dd> (default)
  1 - result in form <yyyymmdd>

example:
   todate 72460
1998 5 23

   todate 0 1 2 3 + todayno 1992 2 27
1992 2 27
1992 2 28
1992 2 29
1992 3  1

todayno............. (v) converts dates to day numbers

converts dates to day numbers, converse <todate>

y. = dates
x. = optional:
  0 - dates in form <yyyy mm dd> (default)
  1 - dates in form <yyyymmdd>
0 = todayno 1800 1 1, or earlier

example:
   todayno 1998 5 23
72460

tsdiff.............. (v) differences between pairs of dates.

form:  end tsdiff begin
  end, begin are vectors or matrices in form YYYY MM DD
  end dates should be later than begin dates

method is to subtract dates on a calendar basis to determine
integral number of months plus the exact number of days remaining.
This is converted to payment periods, where # days remaining are
calculated as: (# days)%365

example:
   1994 10 1 tsdiff 1986 5 23
8.35799

tsrep............... (v) timestamp representation as a single number

form: [opt] timerep times
  opt=0  convert timestamps to numbers (default)
      1  convert numbers to timestamps

timestamps are in 6!:0 format, or matrix of same.

examples:
   tsrep 1800 1 1 0 0 0
0
   ":!.13 tsrep 1995 5 23 10 24 57.24
6165887097240

tstamp.............. (v) format time stamp as: 23 May 1998 16:06:39

y. is time stamp, if empty default to current time

valdate............. (v) validate dates

form: valdate dates
dates is 3-element vector
      or 3-column matrix
      in form YYYY MM DD
returns 1 if valid

weekday............. (v) returns weekday from date, 0=Sunday ... 6=Saturday

arguments as for <todayno>, e.g.

    5 = weekday 1997 5 23 = 1 weekday 19970523

system\main\dates.ijsRelease: 4.02/1998-11-13/12:26