Contact | Privacy | Datenschutzerklärung | Impressum

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()> 2024
<? year(18040229)> 1804
year$() date char <? year$()> 2024
<? year$(18040229)> 1804
year2() date integer <? year2()> 24
<? year2(18040229)> 4
year2$() date char <? year2$()> 24
<? year2$(18040229)> 04
month() date integer <? month()> 3
<? month(18040229)> 2
month$() date char <? month$()> 03
<? month$(18040229)> 02
day() date integer <? day()> 28
<? day(18040205)> 5
day$() date char <? day$()> 28
<? day$(18040205)> 05
hour() time char <? hour()> 21
<? hour(40807000)> 4
hour$() time char <? hour$()> 21
<? hour$(40807000)> 04
minute() time char <? minute()> 52
<? minute(40807000)> 8
minute$() time char <? minute$()> 52
<? minute$(40807000)> 08
sec() time char <? sec()> 52
<? sec(40807000)> 7
sec$() time char <? sec$()> 52
<? 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()> 161237
<? 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()> 3
<? 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()> 88
<? 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()> 13
<? 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(31, 3)> 20240331
<? date(25, 3)> 20250325
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$()> March
<? monthname$(19000528)> May
<let gl.lang="de">
<? monthname$()> html;
März
monthnameshort$()
<? monthnameshort$()> Mar
<? monthnameshort$(15930309)> Mar
<let gl.lang="de">
<? monthnameshort$(15930309) html>
Mär
dayname$()
<? dayname$()> Thursday
<? dayname$(15930309)> Tuesday
<let gl.lang="de">
<? dayname$(15930309) html>
Dienstag
daynameshort$()
<? daynameshort$()> Thu
<? daynameshort$(20000101)> Sat
<let gl.lang="de">
<? daynameshort$(20000101) html>
Sa
tdate$()
<? tdate$()> Thursday March 28 2024
<? tdate$(20000101)> Saturday January 01 2000
<let gl.lang="de">
<? tdate$(20000101) html>
Samstag, 01. Januar 2000
tdate2$()
<? tdate2$()> Thu Mar 28 24
<? tdate2$(19891003)> Tue Oct 03 89
<let gl.lang="de">
<? tdate2$(19891003) html>
Di, 03. Okt. 89
date$()
<? date$()> 2024/03/28
<? date$(20000101)> 2000/01/01
<let gl.lang="de">
<? date$(20000101) html>
01.01.2000
date2$()
<? date2$()> 24/03/28
<? date2$(19891003)> 89/10/03
<let gl.lang="de">
<? date2$(19891003) html>
03.10.89
time$()
<? time$()> 21:52:52
<? time$(115959000)> 11:59:59

Convenience Tags for Date and Time Output

Name Arg Example Output
prtdate date <prtdate> Thursday March 28 2024
<prtdate 20000101> Saturday January 01 2000
<let gl.lang="de">
<prtdate 20000101>
Samstag, 01. Januar 2000
prtdate2 date <prtdate2> Thu Mar 28 24
<prtdate2 19891003> Tue Oct 03 89
<let gl.lang="de">
<prtdate2 19891003>
Di, 03. Okt. 89
prdate date <prdate> 2024/03/28
<prdate 20000101> 2000/01/01
<let gl.lang="de">
<prdate 20000101>
01.01.2000
prdate2 date <prdate2> 24/03/28
<prdate2 19891003> 89/10/03
<let gl.lang="de">
<prdate2 19891003>
03.10.89
prtime time <prtime> 21:52:52
<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:

March 2024
W.Mon Tue Wed Thu Fri Sat Sun
9 123
1045678910
1111121314151617
1218192021222324
1325262728293031

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.

February 2024
W.Mon Tue Wed Thu Fri Sat Sun
5 1234
6567891011
712131415161718
819202122232425
926272829 
March 2024
W.Mon Tue Wed Thu Fri Sat Sun
9 123
1045678910
1111121314151617
1218192021222324
1325262728293031
April 2024
W.Mon Tue Wed Thu Fri Sat Sun
141234567
15891011121314
1615161718192021
1722232425262728
182930 

< 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-2024 H.E.I. All Rights Reserved.



Homepage
Intro/Features
Component Guide
Programming
  Language Guide
  Language Ref.
  Component Ref.
  Class Library
    Library Files
    Std Library
    Ses Library
    Component Library
    Layout Library
    Outline Library
    HTML Extensions
    Date/Time Library
    Math Library
  User Components
  Tutorial
  New Features
  heitml 1
User Guide
Services
Privacy
Datenschutz
 
Contact / Impressum