All the functions come in versions with and without $ at the end of the name. The versions without $ return an integer, the versions with $ return a string that is padded to 2 digits with a possible leading zero. They take an optional argument that defaults to SrvDate or SrvTime.
| Name | Arguments | Return | Example | Output |
|---|---|---|---|---|
| year() | date | integer | <? year()> | 2012 |
| <? year(18040229)> | 1804 | |||
| year$() | date | char | <? year$()> | 2012 |
| <? year$(18040229)> | 1804 | |||
| year2() | date | integer | <? year2()> | 12 |
| <? year2(18040229)> | 4 | |||
| year2$() | date | char | <? year2$()> | 12 |
| <? year2$(18040229)> | 04 | |||
| month() | date | integer | <? month()> | 5 |
| <? month(18040229)> | 2 | |||
| month$() | date | char | <? month$()> | 05 |
| <? month$(18040229)> | 02 | |||
| day() | date | integer | <? day()> | 18 |
| <? day(18040205)> | 5 | |||
| day$() | date | char | <? day$()> | 18 |
| <? day$(18040205)> | 05 | |||
| hour() | time | char | <? hour()> | 13 |
| <? hour(40807000)> | 4 | |||
| hour$() | time | char | <? hour$()> | 13 |
| <? hour$(40807000)> | 04 | |||
| minute() | time | char | <? minute()> | 33 |
| <? minute(40807000)> | 8 | |||
| minute$() | time | char | <? minute$()> | 33 |
| <? minute$(40807000)> | 08 | |||
| sec() | time | char | <? sec()> | 30 |
| <? sec(40807000)> | 7 | |||
| sec$() | time | char | <? sec$()> | 30 |
| <? sec$(40807000)> | 07 |
These Functions perform conversion, checking and arithmetic on Dates. They are restricted to the range from 1582/10/15 (Beginning of the Gregorian calendar to 9999/12/31.
| Name | Arguments | Return | Example | Output |
|---|---|---|---|---|
| Is the given year a leap year? | ||||
| leap() | year | Boolean | <? leap(1996)> | true |
| <? leap(1900)> | false | |||
| The number of days since the start of the Gregorian calendar range, 1582/10/15. For invalid dates -1 is returned and gl.errno set to a text describing the error. | ||||
| daynumm() | year, month, day | integer | <? daynum(1996, 2, 29)> | 150982 |
| The same as above, but for a regular date. The argument defaults to SrvDate. | ||||
| daynum() | date | integer | <? daynum()> | 156905 |
| <? daynum(19000228)> | 115918 | |||
| Day of the week for a given date. Starts on Monday with 0. | ||||
| weekdaym() | year, month, day | integer | <? weekdaym(1996, 2, 29)> | 3 |
| weekday() | date | integer | <? weekday()> | 4 |
| <? weekday(19000228)> | 2 | |||
| Day of the year for a given date. Jan 1 is 1. | ||||
| yeardaym() | year, month, day | integer | <? yeardaym(1996, 2, 29)> | 60 |
| yearday() | date | integer | <? yearday()> | 139 |
| <? yearday(19000228)> | 59 | |||
| Week of the year for a given date according to the ISO standard. | ||||
| yearweekm() | year, month, day | integer | <? yearweekm(1996, 2, 29)> | 9 |
| yearweek() | date | integer | <? yearweek()> | 20 |
| <? yearweek(19000228)> | 9 | |||
| Calculate the date of a given year, yearday combination. | ||||
| yeardaydate() | year, yearday | integer | <? yeardaydate(1996, 59)> | 19960229 |
| Calculate the date of a given calendar daynum. This is the inverse of daynum() | ||||
| daynumate() | daynum | integer | <? daynumate(150982)> | 19960229 |
| Add a number of days to a certain date (to subtract use a negative number) | ||||
| dateadd() | date, num | integer | <? dateadd(19960201, -35)> | 19951228 |
| Return the number of days between two given dates | ||||
| datesub() | date1, date2 | integer | <? datesub(19960307, 19960201)> | 35 |
| Calculate a numeric date from day, month and year (optional) with sanity checking. If not specified, year will be set to the current or the next year. The next year will be used if the date is earlier than the current date. Two digit yearnums will be expanded into the 1900 and 2000 range. Yearnums <20 will be assumed to fall into the 2000 range. | ||||
| date() | day, month, year | integer | <? date(29, 2, 1804)> | 18040229 |
| <? date(20, 2, 84)> | 19840220 | |||
| <? date(29, 2, 85)> | -1 | |||
| <? date(20, 2, 04)> | 20040220 | |||
| <? date(21, 5)> | 20120521 | |||
| <? date(15, 5)> | 20130515 | |||
| calculate a time from hour, min and sec (optional, defaults to 0) | ||||
| time() | hour, min, sec | integer | <? time(11, 58, 34)> | 115834000 |
| <? time(11, 55)> | 115500000 | |||
The following functions and tags perform date and time output tasks. They act language sensitive. Depending on the variable "gl.lang", different date output formats are chosen. Right now the two languages "en" and "de" are implemented, defaulting to "en". If gl.lang is not set, the package will initialize it to "en". The arguments default to SrvDate and SrvTime respectively. Printing the German results, one should remember to use the html formatting argument to the "?" tag to get umlauts printed properly.
| Name | Arguments | Return | Example | Output |
|---|---|---|---|---|
| monthname$() | date | char | <? monthname$()> | May |
| <? monthname$(19000528)> | May | |||
| <let gl.lang="de"> <? monthname$()> | Mai | |||
| monthnameshort$() | date | char | <? monthnameshort$()> | May |
| <? monthnameshort$(15930309)> | Mar | |||
| <let gl.lang="de"> <? monthnameshort$(15930309) html> | Mär | |||
| dayname$() | date | char | <? dayname$()> | Friday |
| <? dayname$(15930309)> | Tuesday | |||
| <let gl.lang="de"> <? dayname$(15930309) html> | Dienstag | |||
| daynameshort$() | date | char | <? daynameshort$()> | Fri |
| <? daynameshort$(20000101)> | Sat | |||
| <let gl.lang="de"> <? daynameshort$(20000101) html> | Sa | |||
| tdate$() | date | char | <? tdate$()> | Friday May 18 2012 |
| <? tdate$(20000101)> | Saturday January 01 2000 | |||
| <let gl.lang="de"> <? tdate$(20000101) html> | Samstag, 01. Januar 2000 | |||
| tdate2$() | date | char | <? tdate2$()> | Fri May 18 12 |
| <? tdate2$(19891003)> | Tue Oct 03 89 | |||
| <let gl.lang="de"> <? tdate2$(19891003) html> | Di, 03. Okt. 89 | |||
| date$() | date | char | <? date$()> | 2012/05/18 |
| <? date$(20000101)> | 2000/01/01 | |||
| <let gl.lang="de"> <? date$(20000101) html> | 01.01.2000 | |||
| date2$() | date | char | <? date2$()> | 12/05/18 |
| <? date2$(19891003)> | 89/10/03 | |||
| <let gl.lang="de"> <? date2$(19891003) html> | 03.10.89 | |||
| time$() | time | char | <? time$()> | 13:33:30 |
| <? time$(115959000)> | 11:59:59 |
| Name | Arguments | Example | Output |
|---|---|---|---|
| prtdate | date | <prtdate> | Friday May 18 2012 |
| <prtdate 20000101> | Saturday January 01 2000 | ||
| <let gl.lang="de"> <prtdate 20000101> | Samstag, 01. Januar 2000 | ||
| prtdate2 | date | <prtdate2> | Fri May 18 12 |
| <prtdate2 19891003> | Tue Oct 03 89 | ||
| <let gl.lang="de"> <prtdate2 19891003> | Di, 03. Okt. 89 | ||
| prdate | date | <prdate> | 2012/05/18 |
| <prdate 20000101> | 2000/01/01 | ||
| <let gl.lang="de"> <prdate 20000101> | 01.01.2000 | ||
| prdate2 | date | <prdate2> | 12/05/18 |
| <prdate2 19891003> | 89/10/03 | ||
| <let gl.lang="de"> <prdate2 19891003> | 03.10.89 | ||
| prtime | time | <prtime> | 13:33:30 |
| <prtime 115959000> | 11:59:59 |
Finally, we have written some tags that allow you to display
formatted calendars within your heitml
Applications. They all honor the setting of
gl.lang. The base functionality is delivered by the
<cal> tag. It displays a single month in
calendar form like this:
| W. | Mon | Tue | Wed | Thu | Fri | Sat | Sun |
|---|---|---|---|---|---|---|---|
| 18 | 1 | 2 | 3 | 4 | 5 | 6 | |
| 19 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |
| 20 | 14 | 15 | 16 | 17 | 18 | 19 | 20 |
| 21 | 21 | 22 | 23 | 24 | 25 | 26 | 27 |
| 22 | 28 | 29 | 30 | 31 | |||
The <cal> tag takes up to 8 arguments:
To show how to use this, there are two additional tags,
<threemcal m=month() y=year()
column=false> and
<yearcal y=year() cols=3 url="" >.
<threemcal> displays a three month
calendar centered around the given month (or the current one). The
current day is marked. You can choose between two layouts,
the months in a row and in a column.
|
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
<threemcal> displays a year calendar for
the given year in the specified number of columns. You can supply
it with a URL and it will generate a header that allows you to
click forward and backward within years.