Codes for HTML current date
Hi there. You can get codes to do that in the following links: www.freevbcode.com/ShowCode.asp?ID=86
You can also use java script to display the current date and time.
Many people disagree that html can do that because it doesn't interact with the user and the machine.
To use JavaScript to do that, here's a code webdesign.about.com/od/examples/l/blaa050701a_date.htm
Enjoy
Codes for HTML current date
Hi,
It would be impossible to use just an HTML language alone to show the current time or date. Â
You need a language that could interact with your computer and with the user, so you can eventually capture the current time. Â
This is where Java scripting comes. Â
The good news though is that you can integrate both programs to display the time and date on your browser.
First start creating the HTML skeleton:
<html>
<head>
<title>EXAMPLE OF TIME AND DATE</title>
</head>
<body>
</body>
</html>
Then add meta elements after the <head> tag.
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="Content-Script-Type" content="text/javascript">
<meta name="Content-Style-Type" content="text/css">
The meta elements written above will tell your browser that it's going to use JavaScript, html and CSS program in your current program. Â
In your <body> insert the following program:
<script type="text/javascript">
document.write ('<p>Current time is: <span id="date-time">', new Date().toLocaleString(), '</span>.</p>')
if (document.getElementById) onload = function () {
setInterval ("document.getElementById ('date-time').firstChild.data = new Date().toLocaleString()", 50)}
</script>
This program is a standard Javascript program that will display the current time and date in your browser. Â Combining it all together this is how it will look like:
I coded this program in notepad, and it worked so far.
Good luck.