473,394 Members | 1,738 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Gettime ??? for displaying server time on browser

I'm trying to display the server time on the local browser, just as
http://www.time.gov does it.

Is there any sample code for JS or VB available?

TIA,
Jul 22 '05 #1
3 3980
becuase asp runs on the server and publishes the page to the client
this will show you the time from the server.
<%=time()%>
or
<%=Now()%>
"Matthew Ferri" <ma***********@worldnet.att.net> wrote in message
news:xm******************@bgtnsc04-news.ops.worldnet.att.net...
I'm trying to display the server time on the local browser, just as
http://www.time.gov does it.

Is there any sample code for JS or VB available?

TIA,

Jul 22 '05 #2
Something like this has worked for me:

mintServerToOrgHourOffset = 1 ' Server is Mountain Time and org is
Central Time.

mvarOrgCurDtTime = DateAdd("H", mintServerToOrgHourOffset, Now())

Best regards,
J. Paul Schmidt, Freelance ASP Web Developer
http://www.Bullschmidt.com
ASP Design Tips, ASP Web Database Demo, Free ASP Bar Chart Tool...
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 22 '05 #3
Matthew Ferri wrote on 23 jan 2005 in
microsoft.public.inetserver.asp.general:
I'm trying to display the server time on the local browser, just as
http://www.time.gov does it.

Is there any sample code for JS or VB available?


This gives running local time with server precision,
irrespective of the server local timezone:
[weekdays in Dutch and dd-mm-yyyy]

=======================================

<script runat=server language=javascript>
ds = new Date();
ds=ds*1;
</script>

<script type='text/javascript'>
ds= <% =ds %>; // UTC server
dc=new Date();
dc=dc*1; // UTC client
dif = ds-dc; // UTC difference

//alert(dif+' is the milliseconds UTC error between server and client')

function two(x){
return ((x<10)?"0":"")+x
}

var wkdgn=["zon","maan","dins","woens","donder","vrij","zater "]

function settijd(){
d = new Date()
d=new Date(d*1+dif);
document.getElementById('tijd').innerHTML=""+
wkdgn[d.getDay()]+"dag "+
two(d.getDate())+"-"+two(d.getMonth()+1)+"-"+d.getYear()+
"<br> <span style='font-size:22pt;font-weight:800;'>"+
two(d.getHours())+":"+two(d.getMinutes())+":"+
two(d.getSeconds())+"</span>"
setTimeout("settijd()",1000)
}

</script>

<body onload='settijd()'>
<div id='tijd'></div>

==================================

--
Evertjan.
The Netherlands.
(Replace all crosses with dots in my emailaddress)

Jul 22 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: yawnmoth | last post by:
i'm trying to display text while a page is loading using a method similar to the following: <? ob_end_flush(); echo 'AAA<br>'; flush(); sleep(10); echo 'BBB'; ?>
3
by: Xiangliang Meng | last post by:
Hi, all class Clock { Clock() { Time_m = 0;} void setTime(unsigned int time = 0) { Time_m = time; } unsigned int getTime() const
8
by: Russ Chinoy | last post by:
Has anyone ever noticed that getTime() returns the same value for both today (5/31/2005) and tomorrow (6/1/2005)? You can quickly see it with this page: <html> <head> <meta...
2
by: Woodmon | last post by:
I'm observing issue with linked images not displaying in either Firefox 1.5b2 or IE6 when running on Win XP (they display fine in either browser on W2k). Example problem HTML is: <a...
2
by: Shane Saunders | last post by:
I trying to make a sub that works like Javascripts .getTime method. It work ok, but it does not should the time in it. The last numbers should be the time, but they are all zeros. Can anyone help...
6
by: Coleen | last post by:
Hi all :-) I need to redirect to multiple pages on click of a transmit button, without redisplaying each page. This redirection is to capture session variables that are created on each page and...
13
by: David W. Fenton | last post by:
I've been struggling the last two days with something I thought was very easy, which is to open a web page with a form on it and populate the form with data passed in a query string (either POST or...
14
by: Brad | last post by:
I have a .net 2.0 web application project that creates a pdf file, saves the pdf to disk (crystal reports does this part), and then my code reads the pdf file and writes it to the httpresponse ...
7
by: RichB | last post by:
I am trying to get to grips with the asp.net ajaxcontrol toolkit, and am trying to add a tabbed control to the page. I have no problems within the aspx file, and can dynamically manipulate a...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.