Advanced:
Adding the Current Date and Time to Your Page
Using
the <ISML> tag, you can include the current date and
time in a web page. You can also format it in various ways.
To include
the date and/or time, insert the following <ISML>
tag into your HTML wherever you want the date and time to
appear:
<ISML
TYPE="date" FORMAT="%m/%d/%yy %h12:%mi:%ss %pm" TIMEZONE="US/Mountain">
This
example would produce the following:
5/7/25 7:47:13 pm
The
date and time format are set using the FORMAT attribute.
For each segment of the date and time, you can choose the
format you want. You can insert any text you want in between
the different segments--however, you may need to use special
codes for some symbols, such as quotation marks to indicate
seconds.
Time/date
segment
|
Format
code
|
Description
|
What
right now looks like (US/Mountain time)
|
What
Wednesday, July 4, 2001, 4:55:07 pm would look like
|
Year |
%yyyy |
4-digit
year |
1999
|
2001
|
%yy |
Last
2 digits of year |
99
|
01
|
%y |
Unpadded
last 2 digits of year |
99
|
1
|
Month |
%month |
Month
name |
December
|
July
|
%mon |
Abbreviated
month name |
Dec
|
Jul
|
%mm |
2-digit
month number |
12
|
07
|
%m |
Unpadded
month number |
12
|
7
|
Day
of month |
%day
or
%dth |
Nth
day of month |
17th
|
4th
|
%dd |
2-digit
day of month |
17
|
04
|
%d |
Unpadded
day of month |
17
|
4
|
Day
of week |
%weekday |
Name
of day |
Friday
|
Wednesday
|
|
%wday |
Abbreviated
name of day |
Fri
|
Wed
|
|
%ww
or
%w |
Number
of day (Sunday=1, Monday=2, etc.) |
6
|
4
|
Hour |
%hh24 |
2-digit
hour in 24-hour format (00-23) |
24
|
16
|
|
%hh12 |
2-digit
hour in 12-hour format (01-12) |
12
|
4
|
|
%hh |
2-digit
hour in 24-hour format, unless %am or %pm are in the
FORMAT attribute |
24
|
16
(unless %am or %pm is in the FORMAT attribute, in
which case it would show 4)
|
|
%h24 |
Unpadded
hour in 24-hour format (0-23) |
24
|
16
|
|
%h12 |
Unpadded
hour in 12-hour format (1-12) |
12
|
4
|
|
%h |
Unpadded
hour in 24-hour format, unless %am or %pm are in the
FORMAT attribute |
24
|
16
(unless %am or %pm is in the FORMAT attribute, in
which case it would show 4)
|
Minute |
%mi |
2-digit
minute (00-59) |
25
|
55
|
Second |
%ss |
2-digit
second (00-59) |
39
|
07
|
am/pm |
%am
or
%pm
|
am
or pm |
am
|
pm
|
" |
" |
Quotation
mark (sometimes used to indicate seconds) |
"
|
"
|
So,
if you wanted to show the date as Wednesday, the 7th of May in the year 2025, at 7:47:13pm,
you would insert the following code into your HTML:
<ISML
TYPE="date" FORMAT="%weekday, the %day
of %month in the year %yyyy, at %h12:%mi:%ss%am"
TIMEZONE="US/Mountain">
The
time zone is set using the TIMEZONE attribute. Click
here to see a list of all available time zones. For
instance, if you wanted to show the time in Oslo, Norway,
you would do the following:
<ISML
TYPE="date" FORMAT="%m/%d/%yy %h12:%mi:%ss %pm" TIMEZONE="Europe/Oslo">
And
here it is: 5/7/25 7:47:13 pm
|