Free web development scripts for the webmasterDevelopment Scripts


 
 Site Navigation
 o Development Scripts
 o Text Only Edition
 o PHP.net News
 o Tutorials
 o Register an account
 o New entries this week
 o Affiliates/Links
 o Contact Us
 o About us
 o Advanced Search

 Browse Path
 o 1 user online
 o Most users online: 67
 o Home
  o Javascripts
   o Miscellaneous
    o Script

 Member Login
User Name
Password

 Standards
Valid XHTML 1.0!
Valid 
CSS!

 Recommended Links
 o PHP Freaks
 o Designer Baby Clothes
 o White Watch Store
 o iPad 64gb 3g
 o Invoice Software
 o Free Wedding Websites
 o Invoice Software
 o OxyScripts
 o UK Business Franchises

Display the date and time in accordance with the ISO 8601 standard. (Rated 0)

Description:

Javascript script to detect the time zone where a browser is and display the date and time in accordance with the ISO 8601 standard.

Code starts here


<!-- THREE STEPS TO INSTALL ISO CLOCK:

1. Copy the coding into the HEAD of your HTML document
2. Add the onLoad event handler into the BODY tag
3. Put the last coding into the BODY of your HTML document

-->

<!-- STEP ONE: Paste this code into the HEAD of your HTML document -->

<HEAD>

<SCRIPT LANGUAGE="JavaScript">

<!--

COLOPHON

TITLE
TempersFewGit v 2.1 (ISO 8601 Date/Time script)

OBJECTIVE
Javascript script to detect the time zone where a browser
is and display the date and time in accordance with the
ISO 8601 standard.

AUTHOR
John Walker
321WebLiftOff.net


ENCOMIUM
Thanks to Stephen Pugh for his help.

CREATED
2000-09-15T09:42:53+01:00

REFERENCES
For more about ISO 8601 see:
www.w3.org/TR/NOTE-datetime
www.cl.cam.ac.uk/~mgk25/iso-time.html

COPYRIGHT
This script is Copyright © 2000 JF Walker All Rights
Reserved but may be freely used provided this colophon is
included in full.

ENDS

-->



<!-- Begin
function isodatetime() {
var today = new Date();
var year = today.getYear();
if (year < 2000) // Y2K Fix, Isaac Powell
year = year + 1900; // http://onyx.idbsu.edu/~ipowell
var month = today.getMonth() + 1;
var day = today.getDate();
var hour = today.getHours();
var hourUTC = today.getUTCHours();
var diff = hour - hourUTC;
var hourdifference = Math.abs(diff);
var minute = today.getMinutes();
var minuteUTC = today.getUTCMinutes();
var minutedifference;
var second = today.getSeconds();
var timezone;
if (minute != minuteUTC && minuteUTC < 30 && diff < 0) { hourdifference--; }
if (minute != minuteUTC && minuteUTC > 30 && diff > 0) { hourdifference--; }
if (minute != minuteUTC) {
minutedifference = ":30";
}
else {
minutedifference = ":00";
}
if (hourdifference < 10) {
timezone = "0" + hourdifference + minutedifference;
}
else {
timezone = "" + hourdifference + minutedifference;
}
if (diff < 0) {
timezone = "-" + timezone;
}
else {
timezone = "+" + timezone;
}
if (month <= 9) month = "0" + month;
if (day <= 9) day = "0" + day;
if (hour <= 9) hour = "0" + hour;
if (minute <= 9) minute = "0" + minute;
if (second <= 9) second = "0" + second;
time = year + "-" + month + "-" + day + "T"
+ hour + ":" + minute + ":" + second + timezone;
document.isoclock.display.value = time;
window.setTimeout("isodatetime();", 500);
}
// End -->
</script>
</HEAD>

<!-- STEP TWO: Insert the onLoad event handler into your BODY tag -->

<BODY OnLoad="isodatetime()">

<!-- STEP THREE: Copy this code into the BODY of your HTML document -->

<center>
<form name=isoclock>
<input type=text name=display size=24 style="border:0; color:#ff0000; background-color:#ffff00;">
</form>
</center>

</body>


Submitted by norvica on 11-03-2003 18:33


Recent Additions (from all categories)

(PHP) T Shirt Printing Software

(PHP) Youtube Video Organizer Script

(PHP) MP3z - MP3 Search Engine Script

(PHP) Recipez- PHP Recipe Script

(ASP) Stop image hotlinking and downloading. Web image protection is easy with Image Trapper.

Top Rated Scripts

(Javascripts) Javascript Delayed Redirection Rating: 5

(PHP) Random Links and images with PHP & MySQL Rating: 5

(PHP) RSS/XML news feed headline grabber! Rating: 5

(PHP) Random Signatures/Avatars Rating: 5

(Javascripts) Detecting Client Web Browser Rating: 5

© Copyright 2003 - Devscripts.net