dates - date and time utilities
v |
formatted calendar for year [months] |
|
v |
get date from character string |
|
v |
format time stamps as: 2000-05-23 16:06:39.268 |
|
v |
converts day numbers to dates |
|
v |
converts dates to day numbers |
|
v |
differences between pairs of dates. |
|
v |
timestamp representation as a single number |
|
v |
format time stamps as: 23 May 1998 16:06:39 |
|
v |
validate dates |
|
v |
returns weekday from date, 0=Sunday ... 6=Saturday |
calendar
calendar (v) formatted calendar for year [months]
returns calendar for year, as a list of months
form:
calendar year [months]
argument is one or more numbers: year, months If no months are given, it defaults to all months.
example:
calendar 2007 11 12 ┌─────────────────────┬─────────────────────┐ │ Nov │ Dec │ │ Su Mo Tu We Th Fr Sa│ Su Mo Tu We Th Fr Sa│ │ 1 2 3│ 1│ │ 4 5 6 7 8 9 10│ 2 3 4 5 6 7 8│ │ 11 12 13 14 15 16 17│ 9 10 11 12 13 14 15│ │ 18 19 20 21 22 23 24│ 16 17 18 19 20 21 22│ │ 25 26 27 28 29 30 │ 23 24 25 26 27 28 29│ │ │ 30 31 │ └─────────────────────┴─────────────────────┘
getdate
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
optional x:
0 = days first - default
23 5 1986
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
isotimestamp
isotimestamp (v) format time stamps as: 2000-05-23 16:06:39.268
y is one or more time stamps in 6!:0 format
todate
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>
examples:
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
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
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
tsrep (v) timestamp representation as a single number
form:
[opt] timerep times
opt=0 convert timestamps to numbers (default)
1 convert numbers to timestampstimestamps 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
timestamp
timestamp (v) format time stamps as: 23 May 1998 16:06:39
y is time stamp, if empty default to current time
valdate
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
weekday (v) returns weekday from date, 0=Sunday ... 6=Saturday
arguments as for <todayno>
examples:
weekday 1997 5 23 5 1 weekday 19970523 5
