In this tutorial you will learn how to post on a web page using ASP programing the date & time. This tutorial is for beginers and explains in a very simple method how to display the date & time.
Date
To display the current date by itself in a Web page, type:
<% =date %>
at the point where you want it to appear. When you view the page in your browser, you should see something like this:
Thu, Jan 23, 1997
Note: Even though "=date" is a short script, it's actually made up of two parts. The "date" part tells the server, "Get me the date." The equal sign (=) tells the server to display the date in the Web page. If you typed just:
-
<% date %>
the server would get the current date from your system, but that's all. It wouldn't display it. There are times when it makes sense to use an ASP function without the equal sign.
Time
To display the current time by itself, type:
-
<% =time %>
where you want it to appear. When you view the page, you should see something like this:
4:19:46 PM
Recent Comments