View Single Post
  #1 (permalink)  
Old Aug 8th, 2007, 14:00
selfAfflicted selfAfflicted is offline
New Member
Join Date: Aug 2007
Location: San Antonio, TX
Age: 21
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Update Date/Time Button

I am wanting to use the server time, or a specific time zone (-5 GMT) to have the update date/time button refer to. Right now this script references the users local time when they click the update date/time button.

My problem is simply that I have many users in different time zones, and when they update an entry, it doesn't make any logical sense to the other time zones. So to make it logical, if they are seeing the same time it can be related to one another.

Thank you for any help!

<html>
<head>
<script language="jscript" type="">
function setcompleted()
{
var myDate = new Date();

var str = (myDate.getMonth()+1) + "/" + pad(myDate.getDate()) + "/" + myDate.getFullYear();

str += " " + pad(myDate.getHours()) + ":" + pad(myDate.getMinutes());

document.forms[0].date_time.value=str;
}
function pad(num)
{
if (num &lt; 10)
return "0" + num;
else
return num;
}
</script>

</head>
<body>
<form>
<input type="text" value="_currentdatetime" name="date_time" required="false"></input>
<button language="jscript" onClick="return setcompleted()">Update Date/Time</button>
</form>
</body>
</html>
Reply With Quote