| |
Date/Time Library
by Michael Elbel
You need to insert < include name="dt2.hei" /> into the beginning of
your page to use the following functions.
Generic Functions
All functions come in versions with and without $ at the end
of the name. Versions without $ return an integer, those
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 |
Arg |
Returns |
Example |
Output |
year() |
date |
integer |
<? year()> |
2025 |
<? year(18040229)> |
1804 |
year$() |
date |
char |
<? year$()> |
2025 |
<? year$(18040229)> |
1804 |
year2() |
date |
integer |
<? year2()> |
25 |
<? year2(18040229)> |
4 |
year2$() |
date |
char |
<? year2$()> |
25 |
<? year2$(18040229)> |
04 |
month() |
date |
integer |
<? month()> |
2 |
<? month(18040229)> |
2 |
month$() |
date |
char |
<? month$()> |
02 |
<? month$(18040229)> |
02 |
day() |
date |
integer |
<? day()> |
16 |
<? day(18040205)> |
5 |
day$() |
date |
char |
<? day$()> |
16 |
<? day$(18040205)> |
05 |
hour() |
time |
char |
<? hour()> |
18 |
<? hour(40807000)> |
4 |
hour$() |
time |
char |
<? hour$()> |
18 |
<? hour$(40807000)> |
04 |
minute() |
time |
char |
<? minute()> |
12 |
<? minute(40807000)> |
8 |
minute$() |
time |
char |
<? minute$()> |
12 |
<? minute$(40807000)> |
08 |
sec() |
time |
char |
<? sec()> |
51 |
<? sec(40807000)> |
7 |
sec$() |
time |
char |
<? sec$()> |
51 |
<? sec$(40807000)> |
07 |
Date Conversion and Arithmetic Functions
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 |
Args |
Example |
Output |
Is the given year a leap year? |
leap() |
year |
<? 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 |
<? daynum(1996, 2, 29)> |
150982 |
The same as above, but for a regular date.
The argument defaults to SrvDate. |
daynum() |
date |
<? daynum()> |
161562 |
<? daynum(19000228)> |
115918 |
Day of the week for a given date.
Starts on Monday with 0. |
weekdaym() |
year, month, day |
<? weekdaym(1996, 2, 29)> |
3 |
weekday() |
date |
<? weekday()> |
6 |
<? weekday(19000228)> |
2 |
Day of the year for a given date. Jan 1 is 1.
|
---|
yeardaym() |
year, month, day |
<? yeardaym(1996, 2, 29)> |
60 |
yearday() |
date |
<? yearday()> |
47 |
<? yearday(19000228)> |
59 |
Week of the year for a given date according
to the ISO standard. |
yearweekm() |
year, month, day |
<? yearweekm(1996, 2, 29)> |
9 |
yearweek() |
date |
<? yearweek()> |
7 |
<? yearweek(19000228)> |
9 |
Calculate the date of a given year,
yearday combination. |
yeardaydate() |
year, yearday |
<? yeardaydate(1996, 59)> |
19960229 |
Calculate the date of a given calendar daynum.
This is the inverse of daynum() |
daynumate() |
daynum |
<? daynumate(150982)> |
19960229 |
Add a number of days to a certain date
(to subtract use a negative number) |
dateadd() |
date, num |
<? dateadd(19960201, -35)> |
19951228 |
Return the number of days between two given dates |
datesub() |
date1, date2 |
<? 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 |
<? date(29, 2, 1804)> |
18040229 |
<? date(20, 2, 84)> |
19840220 |
<? date(29, 2, 85)> |
-1 |
<? date(20, 2, 04)> |
20040220 |
<? date(19, 2)> |
20250219 |
<? date(13, 2)> |
20260213 |
Calculate a time from hour, min and sec (optional, defaults to 0) |
time() |
hour, min, sec |
<? time(11, 58, 34)> |
115834000 |
<? time(11, 55)> |
115500000 |
Date and Time Text Output Functions and Tags
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.
Functions Returning Text Formats for Months, Weekdays, Date and Time
Example |
Output |
monthname$() |
<? monthname$()> |
February |
<? monthname$(19000528)> |
May |
<let gl.lang="de">
<? monthname$()> html; |
Februar |
monthnameshort$() |
<? monthnameshort$()> |
Feb |
<? monthnameshort$(15930309)> |
Mar |
<let gl.lang="de">
<? monthnameshort$(15930309) html> |
Mär |
dayname$() |
<? dayname$()> |
Sunday |
<? dayname$(15930309)> |
Tuesday |
<let gl.lang="de">
<? dayname$(15930309) html> |
Dienstag |
daynameshort$() |
<? daynameshort$()> |
Sun |
<? daynameshort$(20000101)> |
Sat |
<let gl.lang="de">
<? daynameshort$(20000101) html> |
Sa |
tdate$() |
<? tdate$()> |
Sunday February 16 2025 |
<? tdate$(20000101)> |
Saturday January 01 2000 |
<let gl.lang="de">
<? tdate$(20000101) html> |
Samstag, 01. Januar 2000 |
tdate2$() |
<? tdate2$()> |
Sun Feb 16 25 |
<? tdate2$(19891003)> |
Tue Oct 03 89 |
<let gl.lang="de">
<? tdate2$(19891003) html> |
Di, 03. Okt. 89 |
date$() |
<? date$()> |
2025/02/16 |
<? date$(20000101)> |
2000/01/01 |
<let gl.lang="de">
<? date$(20000101) html> |
01.01.2000 |
date2$() |
<? date2$()> |
25/02/16 |
<? date2$(19891003)> |
89/10/03 |
<let gl.lang="de">
<? date2$(19891003) html> |
03.10.89 |
time$() |
<? time$()> |
18:12:51 |
<? time$(115959000)> |
11:59:59 |
Convenience Tags for Date and Time Output
Name |
Arg |
Example |
Output |
prtdate |
date |
<prtdate> |
Sunday February 16 2025 |
<prtdate 20000101> |
Saturday January 01 2000 |
<let gl.lang="de">
<prtdate 20000101> |
Samstag, 01. Januar 2000 |
prtdate2 |
date |
<prtdate2> |
Sun Feb 16 25 |
<prtdate2 19891003> |
Tue Oct 03 89 |
<let gl.lang="de">
<prtdate2 19891003> |
Di, 03. Okt. 89 |
prdate |
date |
<prdate> |
2025/02/16 |
<prdate 20000101> |
2000/01/01 |
<let gl.lang="de">
<prdate 20000101> |
01.01.2000 |
prdate2 |
date |
<prdate2> |
25/02/16 |
<prdate2 19891003> |
89/10/03 |
<let gl.lang="de">
<prdate2 19891003> |
03.10.89 |
prtime |
time |
<prtime> |
18:12:51 |
<prtime 115959000> |
11:59:59 |
Calendar Tags
Finally, we have written some tags that allow you to display
formatted calendars within your heitml
Applications. They all follow the setting of
gl.lang .
< cal m y dmark, mmark, wcol, sacol, sucol, mcol />
The base functionality is delivered by the
<cal> tag. It displays a single month in
calendar form like this:
February 2025
W. | Mon | Tue | Wed | Thu | Fri | Sat | Sun |
---|
5 | | 1 | 2 |
6 | 3 | 4 | 5 | 6 | 7 | 8 | 9 |
7 | 10 | 11 | 12 | 13 | 14 | 15 | 16 |
8 | 17 | 18 | 19 | 20 | 21 | 22 | 23 |
9 | 24 | 25 | 26 | 27 | 28 | |
|
The <cal> takes up to 8 arguments:
m: |
The month the calendar shall be displayed for. Defaults to month() |
y: |
The year the calendar shall be displayed for. Defaults to year() |
dmark, mmark: |
The month and a day of the month that shall be marked
(e.g. to show the current date) |
wcol, sacol, sucol and mcol: |
The text colors to use for yearweek, saturday, sunday and the
marked day |
To show how to use this, there are two additional tags:
<threemcal> and
<yearcal>.
< threemcal m=month() y=year() column=true />
<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.
January 2025
W. | Mon | Tue | Wed | Thu | Fri | Sat | Sun |
---|
1 | | 1 | 2 | 3 | 4 | 5 |
2 | 6 | 7 | 8 | 9 | 10 | 11 | 12 |
3 | 13 | 14 | 15 | 16 | 17 | 18 | 19 |
4 | 20 | 21 | 22 | 23 | 24 | 25 | 26 |
5 | 27 | 28 | 29 | 30 | 31 | | |
February 2025
W. | Mon | Tue | Wed | Thu | Fri | Sat | Sun |
---|
5 | | 1 | 2 |
6 | 3 | 4 | 5 | 6 | 7 | 8 | 9 |
7 | 10 | 11 | 12 | 13 | 14 | 15 | 16 |
8 | 17 | 18 | 19 | 20 | 21 | 22 | 23 |
9 | 24 | 25 | 26 | 27 | 28 | | |
March 2025
W. | Mon | Tue | Wed | Thu | Fri | Sat | Sun |
---|
9 | | 1 | 2 |
10 | 3 | 4 | 5 | 6 | 7 | 8 | 9 |
11 | 10 | 11 | 12 | 13 | 14 | 15 | 16 |
12 | 17 | 18 | 19 | 20 | 21 | 22 | 23 |
13 | 24 | 25 | 26 | 27 | 28 | 29 | 30 |
14 | 31 | | |
|
< yearcal y=year() cols=3 url="" />
<yearcal> 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.
This page was dynamically generated by the
web application development tool RADpage
of H.E.I.
H.E.I. provides support, tools, and services like
Webdesign in Mannheimm,
the HTML/CSS 3D WebGL Animation Library taccgl,
3D Webdesign, and
3D Product ConfiguratorDemo
(3D Produkt Konfigurator Demo in German).
© 1996-2025 H.E.I. All Rights Reserved.
|