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()> 2017
<? year(18040229)> 1804
year$() date char <? year$()> 2017
<? year$(18040229)> 1804
year2() date integer <? year2()> 17
<? year2(18040229)> 4
year2$() date char <? year2$()> 17
<? year2$(18040229)> 04
month() date integer <? month()> 10
<? month(18040229)> 2
month$() date char <? month$()> 10
<? month$(18040229)> 02
day() date integer <? day()> 21
<? day(18040205)> 5
day$() date char <? day$()> 21
<? day$(18040205)> 05
hour() time char <? hour()> 7
<? hour(40807000)> 4
hour$() time char <? hour$()> 07
<? hour$(40807000)> 04
minute() time char <? minute()> 3
<? minute(40807000)> 8
minute$() time char <? minute$()> 03
<? minute$(40807000)> 08
sec() time char <? sec()> 44
<? sec(40807000)> 7
sec$() time char <? sec$()> 44
<? 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()> 158887
<? 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()> 5
<? 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()> 294
<? 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()> 42
<? 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(24, 10)> 20171024
<? date(18, 10)> 20181018
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$()> October
<? monthname$(19000528)> May
<let gl.lang="de">
<? monthname$()> html;
Oktober
monthnameshort$()
<? monthnameshort$()> Oct
<? monthnameshort$(15930309)> Mar
<let gl.lang="de">
<? monthnameshort$(15930309) html>
Mär
dayname$()
<? dayname$()> Saturday
<? dayname$(15930309)> Tuesday
<let gl.lang="de">
<? dayname$(15930309) html>
Dienstag
daynameshort$()
<? daynameshort$()> Sat
<? daynameshort$(20000101)> Sat
<let gl.lang="de">
<? daynameshort$(20000101) html>
Sa
tdate$()
<? tdate$()> Saturday October 21 2017
<? tdate$(20000101)> Saturday January 01 2000
<let gl.lang="de">
<? tdate$(20000101) html>
Samstag, 01. Januar 2000
tdate2$()
<? tdate2$()> Sat Oct 21 17
<? tdate2$(19891003)> Tue Oct 03 89
<let gl.lang="de">
<? tdate2$(19891003) html>
Di, 03. Okt. 89
date$()
<? date$()> 2017/10/21
<? date$(20000101)> 2000/01/01
<let gl.lang="de">
<? date$(20000101) html>
01.01.2000
date2$()
<? date2$()> 17/10/21
<? date2$(19891003)> 89/10/03
<let gl.lang="de">
<? date2$(19891003) html>
03.10.89
time$()
<? time$()> 07:03:44
<? time$(115959000)> 11:59:59

Convenience Tags for Date and Time Output

Name Arg Example Output
prtdate date <prtdate> Saturday October 21 2017
<prtdate 20000101> Saturday January 01 2000
<let gl.lang="de">
<prtdate 20000101>
Samstag, 01. Januar 2000
prtdate2 date <prtdate2> Sat Oct 21 17
<prtdate2 19891003> Tue Oct 03 89
<let gl.lang="de">
<prtdate2 19891003>
Di, 03. Okt. 89
prdate date <prdate> 2017/10/21
<prdate 20000101> 2000/01/01
<let gl.lang="de">
<prdate 20000101>
01.01.2000
prdate2 date <prdate2> 17/10/21
<prdate2 19891003> 89/10/03
<let gl.lang="de">
<prdate2 19891003>
03.10.89
prtime time <prtime> 07:03:44
<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:

October 2017
W.Mon Tue Wed Thu Fri Sat Sun
39 1
402345678
419101112131415
4216171819202122
4323242526272829
443031 

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.

September 2017
W.Mon Tue Wed Thu Fri Sat Sun
35 123
3645678910
3711121314151617
3818192021222324
39252627282930 
October 2017
W.Mon Tue Wed Thu Fri Sat Sun
39 1
402345678
419101112131415
4216171819202122
4323242526272829
443031 
November 2017
W.Mon Tue Wed Thu Fri Sat Sun
44 12345
456789101112
4613141516171819
4720212223242526
4827282930 

< 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.
© 1996-2017 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
  Tryout Form
  Tutorial
  New Features
  heitml 1
User Guide
FAQ
Mailinglist
Discussion Group
Services
Pricing/Register
Download
Frame
 
Contact
 
 
 
Search: