Link to home
Start Free TrialLog in
Avatar of a466-ub52
a466-ub52

asked on

Show Server Date on an HTML Page

Hello,

Please can anyone show me a simple way to show the current server date on an HTML page?

Javascript is OK.  Please, just as easy as possible.

Thanks!!

ubee...
ASKER CERTIFIED SOLUTION
Avatar of BogoJoker
BogoJoker

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of a466-ub52
a466-ub52

ASKER

Hi there,

Thanks for you reply!

How would I include that php inside an HTML page?

Thanks!!

ubee...
Cut and paste that exact like that I wrote:
<?php print time(); ?>

I can format it however you want, did you want dd/mm/yyyy or hour:min:second, tell me how you would like it.
Also you must have PHP enabled on your server for this to work.  Hopefully you have php.

Joe P
Hello Joe,

That's great.  Thanks so much!!  Please like this:

Wednesday Apr 19 2006

ubee...

Sure:
<?php print date("l M j Y"); ?>

That prints what you want, the only thing you can change is if you want leading zeros on the day like:
Wednesday Apr 05 2006 instead of Wednesday Apr 5 2006 then use:
<?php print date("l M d Y"); ?>

Joe P
Hmmm... coming up empty.  Is there any special leading code to help the HTML recognize the php?

Thanks!!

ubee...
Once again, do you have php installed on the webserver?

Joe P
Hi Joe P,

Need to edit the htaccess file, apparently. So, just saved it as a .php file.  Your solution is perfect!  THat's save me so much S E A R C H I I I I N G!!  Thanks!! ~~

Are there any other nifty one line thigs like that that you are fond of.  Little things one can drop into a page that you like?

Thanks again for your help

ubee...

Hehe, that was not that hard. =)
Whatever you want, little things like that, a visit counter, small stuff like that we can work up little scripts.
Joe P
Anything you think is just cool & fun / useful for visitors?  How about server temperature? :)

Thanks!!

ubee...
Hmm, that is a good idea.  Get the temperature.  You could get an RSS feed from weather.com or some place, use a regular expression to get the temperature.  Everytime the page is reloaded it would get that xml (RSS feed is xml) and find the temperature and print that.  To get the weather of the person visiting the site you would need their zip code.  If you have logged in users visiting your site that would make more sense.

Joe P