Date and Time
This program will return an image with the current date and time on it.
The script can be accessed by using the following bit of HTML:
<img src="/cgi-bin/dateandtime">
Without passing it any data then it will pass back an image like this:
However, to tailor this more to your taste there are a number of optional parameters you can pass to the program to change it (note that the first attribute in a CGI is always denoted by a "?"; any subsequent ones use "&").
colour Although the default colour is black, there are 24 colours to choose from - essentially the same as those used for Orpheus's counter. Only the text colour is changed, the background is always transparent.
0 |
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
In additional, the eight main colours can be called by name:
black |
red |
green |
yellow |
blue |
cyan |
magenta |
white |
example: | <img src="/cgi-bin/ dateandtime?colour=blue">
|
or: | <img src="/cgi-bin/ dateandtime?colour=4">
|
both return: | |
bold
The default font is quite thin, but if you have quite a strong background colour this might not show up very well. In this case you could try adding the bold attribute - available in two versions, as well as off:
bold= | Meaning |
0 | off - you don't actually have to use this |
1 (or true) | on - text has double thickness |
2 | double thickness in both height and depth |
example: | <img src="/cgi-bin
/dateandtime?bold=0">
|
returns: | |
example: | <img src="/cgi-bin
/dateandtime?bold=1">
|
returns: | |
example: | <img src="/cgi-bin
/dateandtime?bold=2">
|
returns: | |
format
It may be that, for your website, the standard format doesn't suit you - either it's too long, too short, or just won't align with text properly. So, perhaps
Numeric | Textual | Meaning |
0 | | the standard format - you don't actually have to use this |
1 | long, or verbose | all the words are written out in full; the time comes first, too. |
2 | short | outputs a very short version, suitable for where space it at a premium. |
example: | <img src="/cgi-bin
/dateandtime?format=1">
|
returns: | |
example: | <img src="/cgi-bin
/dateandtime?format=2">
|
returns: | |
clock
By default the program always put the time somewhere in the image, and always uses the 24 hour clock (now that we're all good Europeans). However, this might not suit your purpose; a proper 12 hour clock, or no time at all, might be more to your taste.
clock= | Meaning |
0 (or off) | Switch the time part off altogther - note that this won't work if you're using verbose format |
12 | 12 hour clock, e.g. 1:35pm |
24 | standard output (so you don't really need to use it) - 13:35 |
example: | <img src="/cgi-bin
/dateandtime?clock=12">
|
returns: | |
example: | <img src="/cgi-bin
/dateandtime?clock=0">
|
returns: | |
Examples
example: | <img src="/cgi-bin
/dateandtime ?colour=white
&bold=2
&format=verbose">
|
returns: | |
|
example: | <img src="/cgi-bin
/dateandtime ?colour=2
&bold=1
&clock=12">
|
returns: | |
|
example: | <img src="/cgi-bin
/dateandtime ?format=short
&clock=0">
|
returns: | |
Final notes
It should be noted that, although the image returned is always 16 pixels high, you should never give the image a width attribute (e.g. <img src="..." width="100"...> because it may be different every time - it depends on the date.
Don't panic!
Don't panic if you add the necessary code only to find the image doesn't appear - you will not be able to see the image unless you are actually connected to the Internet, as the program necessary to run it is located on our server.
Additional Support
Computer Systems
Game Consoles |
|