Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Snitz Forums 2000 MOD-Group
 MOD Add-On Forum (W/Code)
 Display Server and local time
 New Topic  Topic Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

GBurch
Junior Member

United Kingdom
107 Posts

Posted - 11 June 2001 :  17:03:51  Show Profile
I have written this code, which can be pasted anywhere you like in any of your snitz pages (I put it inc_top.asp), which will display the Server time (With whatever adjustment you specified), and the users local time. This allows users to see the time difference between the server, and themselves.
<font face="<% =strDefaultFontFace %>" size="<% =strFooterFontSize %>">Server 
Time:
<% =ChkTime(DateToStr(strForumTimeAdjust)) %>
<br>
Your Local Time:
<script language="JavaScript">
var hr
var hour
var mins
var minutes
var secs
var seconds
now1 = new Date();
hr = now1.getHours();
mins = now1.getMinutes();
secs = now1.getSeconds();
if(now1.getHours() < 10){
hour = "0" +hr+""}
else
hour = "" +hr+"";
if(now1.getMinutes() < 10){
minutes = "0" +mins+""}
else
minutes = "" +mins+"";
if(now1.getSeconds() < 10){
seconds = "0" +secs+""}
else
seconds = "" +secs+"";
document.write("" +hour+":" +minutes+":" +seconds+"")
</script>
</font>

You can see an example of this here


http://www.captgb.dabsol.co.uk
http://www.slipstreamservices.com


Edited by - GBurch on 11 June 2001 17:05:37

Classicmotorcycling
Development Team Leader

Australia
2084 Posts

Posted - 12 June 2001 :  16:34:48  Show Profile
GBurch,

I hope you don't mind, but I re-wrote a version for people who like to see a 12 hour clock, like me..

<font face="<% =strDefaultFontFace %>" size="<% =strFooterFontSize %>">Server
Time:
<% =ChkTime(DateToStr(strForumTimeAdjust)) %>

Your Local Time:
<SCRIPT LANGUAGE="JavaScript">
<!--
d = new Date();
minuteValue = d.getMinutes();
if (minuteValue < 10)
minuteValue = "0" + minuteValue

secondValue = d.getSeconds();
if (secondValue < 10)
secondValue = "0" + secondValue

hourValue = d.getHours();
if (hourValue < 12)
{
timeText = + hourValue + ":" + minuteValue + ":" + secondValue + " AM";
}
else if (hourValue == 12)
{
timeText = + hourValue + ":" + minuteValue + ":" + secondValue + " PM";
}
else if (hourValue > 12)
{
timeText = + (hourValue-12) + ":" + minuteValue + ":" + secondValue + " PM";
}
document.open();
document.write(" " + timeText + " ");
//-->
</SCRIPT>
</font>


This shows the AM & PM for the local time, which would match for those who use the 12 hour format.

quote:

I have written this code, which can be pasted anywhere you like in any of your snitz pages (I put it inc_top.asp), which will display the Server time (With whatever adjustment you specified), and the users local time. This allows users to see the time difference between the server, and themselves.


You can see an example of this here


http://www.captgb.dabsol.co.uk
http://www.slipstreamservices.com


Edited by - GBurch on 11 June 2001 17:05:37



Regards,

Webmaster @ Classic Motor Cycling
Classic Motor Cycling

Edited by - Classicmotorcycling on 13 June 2001 23:58:55
Go to Top of Page

GBurch
Junior Member

United Kingdom
107 Posts

Posted - 12 June 2001 :  17:03:52  Show Profile
quote:

I hope you don't mind, but I re-wrote a version for people who like to see a 12 hour clock, like me..


I don't mind at all, it gives people more choice.

http://www.captgb.dabsol.co.uk
http://www.slipstreamservices.com
Go to Top of Page

cydoniax
New Member

57 Posts

Posted - 20 June 2001 :  10:14:13  Show Profile  Send cydoniax a Yahoo! Message
Thanks for the code - this is exactly what I was looking for.

I'd like to insert the code right below the forum logo - I'm still new with this code stuff. Can someone give me a hint where exactly to insert it? I'm just afraid I'm going to break up the existing code on inc_top incorrectly - which line do I start and which do I finish?

Sorry, I'm recovering from a forum crash in which I lost everything - I'm a little gun shy at the moment.

Thanks for the help!

Go to Top of Page

dayve
Forum Moderator

USA
5820 Posts

Posted - 20 June 2001 :  10:42:57  Show Profile  Visit dayve's Homepage
Why not just write this to the database as well? I am going to because members are complaining that their posts are timestamped incorrectly. I told them it is because of where the server resides but now that I think about it, server time stamp and client time stamp would be nice.

Dayve
Go to Top of Page

Syedur
New Member

USA
93 Posts

Posted - 22 June 2001 :  22:52:49  Show Profile  Visit Syedur's Homepage  Send Syedur an AOL message  Send Syedur an ICQ Message  Send Syedur a Yahoo! Message
What if you have the TimeZone mod installed...
Then both of the time display the same...
Is there a code to get the forum's default time value set by the Admin?
Thanks.


There is a time in every man’s education when he arrivers at the conviction that envy is ignorance; that imitation is suicide.
Go to Top of Page

bonkers
Junior Member

United Kingdom
122 Posts

Posted - 23 June 2001 :  09:48:28  Show Profile  Visit bonkers's Homepage
quote:

I have written this code, which can be pasted anywhere you like in any of your snitz pages (I put it inc_top.asp), which will display the Server time (With whatever adjustment you specified), and the users local time. This allows users to see the time difference between the server, and themselves.
<font face="<% =strDefaultFontFace %>" size="<% =strFooterFontSize %>">Server 
Time:
<% =ChkTime(DateToStr(strForumTimeAdjust)) %>
<br>
Your Local Time:
<script language="JavaScript">
var hr
var hour
var mins
var minutes
var secs
var seconds
now1 = new Date();
hr = now1.getHours();
mins = now1.getMinutes();
secs = now1.getSeconds();
if(now1.getHours() < 10){
hour = "0" +hr+""}
else
hour = "" +hr+"";
if(now1.getMinutes() < 10){
minutes = "0" +mins+""}
else
minutes = "" +mins+"";
if(now1.getSeconds() < 10){
seconds = "0" +secs+""}
else
seconds = "" +secs+"";
document.write("" +hour+":" +minutes+":" +seconds+"")
</script>
</font>

You can see an example of this here


http://www.captgb.dabsol.co.uk
http://www.slipstreamservices.com

Edited by - GBurch on 11 June 2001 17:05:37


would it be possible to add a time of day greeting into this piece of code.

thx bonkers

Go to Top of Page

GBurch
Junior Member

United Kingdom
107 Posts

Posted - 26 July 2001 :  20:04:27  Show Profile
The time of day greeting is a separate MOD, which runs via JavaScript on the client side (so time of day is appropriate to the clock settings on the user's machine). I didn't write that code, I found it on here somewhere.

http://www.captgb.dabsol.co.uk
http://www.slipstreamservices.com
Go to Top of Page

fpgal
New Member

93 Posts

Posted - 18 August 2001 :  02:23:22  Show Profile
Just want to say thank you, GBurch and Classicmotorcycling! This is very useful for my users!

I also want to suggest one small change - as the code is, the hour after midnight shows up as 00:xx:xx. So I made the changes in red to get it to show 12 a.m.:



if (hourValue == 0)
{
timeText = "12:" + minuteValue + ":" + secondValue + " AM";
}
else if (hourValue >= 1 && hourValue <= 11)
{
timeText = hourValue + ":" + minuteValue + ":" + secondValue + " AM";
}

else if (hourValue == 12)
{
timeText = + hourValue + ":" + minuteValue + ":" + secondValue + " PM";
}
else if (hourValue > 12)
{
timeText = + (hourValue-12) + ":" + minuteValue + ":" + secondValue + " PM";
}






Edited by - fpgal on 26 August 2001 09:09:52
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Topic Locked
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.2 seconds. Powered By: Snitz Forums 2000 Version 3.4.07