Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Server Time Using Javascript

Status
Not open for further replies.

noyes99

Programmer
Jun 25, 2002
38
IN
Hi, Could someone help me with this one please. I need to find out the time on my server ( not clients machine ), using javascript, while executing a page. How do I go about doing it?

Thanks in advance.

- n

 
you'll need to incorpurate some sort of server side coding to gain access to the server time. ASp, PHP etc.

_______________________________________________
{ str = "sleep is good for you. sleep gives you the energy you need to function";
ptr = /sleep/gi;Nstr = str.replace(ptr,"coffee");alert(Nstr); }

_______________________________________________
for the best results to your questions: FAQ333-2924
has you're questio
 
how do i go about doing that? do I simply need the time at the point of generation of page. don't need it when user clicks on any button or anything. would i still need php asp? thanks.

- n
 
as far as I remember there's no way to get it on the client level.
you'll need to figure out what you have the resources to run server side. if you have the option to run a ASP page then it would be fairly simple to get it.
Here's a ASP example:
function srvTime() {
var CurSrvTime = <%=now%>
}
and then save the page as a .asp page.
I may be wrong on the javascript capabilities but I'm fairly certain. _______________________________________________
{ str = &quot;sleep is good for you. sleep gives you the energy you need to function&quot;;
ptr = /sleep/gi;Nstr = str.replace(ptr,&quot;coffee&quot;);alert(Nstr); }

_______________________________________________
for the best results to your questions: FAQ333-2924
has you're questio
 
thanks for your lead. i will look into it.

-n
 
noyes99-

I know this is old technology, but you could use server side includes too...I can't say as that I remember what the call for the server time is tho. Robert Carpenter
questions? comments? thanks? email me!
linkemapx@hotmail.com
Icq: 124408594
online.dll

AIM & MSN: robacarp
 
;-) See, at least there is someone around here that supports me!

Robert Carpenter
questions? comments? thanks? email me!
linkemapx@hotmail.com
Icq: 124408594
online.dll

AIM & MSN: robacarp
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top