Jump to content
xisto Community
TheJeffsta

Get A Clock On Site

Recommended Posts

I am just wondering how to get the current time on a weboage. Ive got one that gets the info from the viewers computer, but i want one that gets the time from a server that has the current time and all of that. Can someone help me out with the code?I am currently using Microsoft Frontpage 2003. I also have Dreamweaver MX 2004 if its easier in that.

Share this post


Link to post
Share on other sites

You can search something like "javascript display server time" on Google, and that should give you a lot of scripts. This is one of the scripts I found.
If you want to write your own script, you can study the scripts you found to see how they work.

Share this post


Link to post
Share on other sites

That is easy with php and you could mix it into an html file (Xisto supports PHP so here's the big program.

To see it work on your server just name the below tiny file something like time.php and put it on your Xisto server maybe in the root and then just typer http://forums.xisto.com/no_longer_exists/ and you will see the time and if you need more about how to use it or include it in a header and or footer thenit could be displayed in the top and bottom of your pages. Here's the tiny code

<?php$time=date("g:i:s;a");echo ($time);?>
Hope that helps.

Share this post


Link to post
Share on other sites

thanks, Houdini, it works. You made me write down my first php program. (Sorry, you explained me how to cut-and-paste into my first php program).It's nice to see something new working at first time.

Share this post


Link to post
Share on other sites

You are welcome, it was simple that is what I love about PHP it can do some pretty neat stuuf with little effort. All you need is a goo reference on the date funtions, then you can format your time anyway you want, you could also get more sophisticated and have it refresh every second but that is just a little much.Glad it helped you out!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.