Discussion Locked

Date & time on Web Pages

0 helpful
7 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.
I am currently designing a website for a local company who wants the date & time to be displayed on his homepage. Is there an HTML tag that lets you do this or does anyone know the correct code to be used?

7 replies

by juanja

As far as I know there is no HTML tag for that.
The easiest way to do it ( as a see it ) would be with active Server Pages (ASP). However this aproach requires your server to support ASP. If it does, place this piece of code I use in the place where you want to display the date:

<%
dim days1(7), months1(12)
days1(1)="Sunday"
days1(2)="Monday"
days1(3)="Tuesday"
days1(4)="Wednesday"
days1(5)="Thursday"
days1(6)="Friday"
days1(7)="Saturday"
months1(1)="January"
months1(2)="February"
months1(3)="March"
months1(4)="April"
months1(5)="May"
months1(6)="June"
months1(7)="July"
months1(8)="August"
months1(9)="September"
months1(10)="October"
months1(11)="November"
months1(12)="December"
dayofweek=weekday(date)
monthofyear=month(date)
appendA="th"
checkd=day(date)
if checkd=1 then appendA="st"
if checkd=2 then appendA="nd"
if checkd=3 then appendA="rd"
%>
<%= days1(dayofweek) %>, <%= months1(monthofyear) %>  <%= day(date) & appendA & ", " & year(date) %>
The page must be named SOMETHING.ASP (ASP extension)

by chrandrob

Whoa! This code will display a static date and time on a website using ASP just as well as the previous example:

<%=Now()%>

You can also download javascript ones from many sites on the net. Try www.netscape.com for one of them.

This discussion is closed to new replies.