Wolverine68 Posted June 25, 2007 Share Posted June 25, 2007 Hello, I'm trying to display the date and time on a webpage. Here's the code for the PHP file, named "time.php": <html> <body> <?php echo date("m/d/y : h:i:A", timestamp) ?> </body> </html> ************************* I then tried to display it on my html page this way: <p align="center"><?php include("cgi-bin\time.php") ?)</p> ************************* It did not display. Any suggestions? Ken Quote Link to comment Share on other sites More sharing options...
pocobueno1388 Posted June 25, 2007 Share Posted June 25, 2007 You can't use PHP in a .html document. If you would like to include it in your HTML page, your gonna have to change it from .html to .php. Quote Link to comment Share on other sites More sharing options...
Wolverine68 Posted June 25, 2007 Author Share Posted June 25, 2007 Do you mean change the "time.php" file to "time.html"? Quote Link to comment Share on other sites More sharing options...
chrisuk Posted June 25, 2007 Share Posted June 25, 2007 no what he means is that a page with a .html extension will not process PHP code Quote Link to comment Share on other sites More sharing options...
chocopi Posted June 25, 2007 Share Posted June 25, 2007 no if you have it saved as .php then it is right instead try <?php $date = date("m/d/y : h:i:A", timestamp) echo $date; ?> That should be fine Just out of intrest what does timestamp after it so ? ~ Chocopi Quote Link to comment Share on other sites More sharing options...
chrisuk Posted June 25, 2007 Share Posted June 25, 2007 Just out of intrest what does timestamp after it so ? ~ Chocopi I was thinking the same thing....i've not used that before! I simply use: $today = date("l d F, Y"); Quote Link to comment Share on other sites More sharing options...
per1os Posted June 25, 2007 Share Posted June 25, 2007 Just out of intrest what does timestamp after it so ? ~ Chocopi The timestamp could be a constant he defines somewhere else. If it is not it needs to be time() instead of timestamp. Quote Link to comment Share on other sites More sharing options...
akitchin Posted June 25, 2007 Share Posted June 25, 2007 could also be a syntactical issue. should be: <p align="center"><?php include("cgi-bin\time.php"); ?></p> PS: you dont need the HTML tags in the time.php file. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.