PDA

View Full Version : Most compact way to display todays date on a page?


Bill
2004-09-12, 02:20 AM
The topic pretty much says it - I'm looking for the most compact scripting to display todays date on a page.

The javascript stuff seems pretty bulky, is there some way to do it that doesn't take multiple lines of script?

Wazza
2004-09-12, 03:09 AM
http://www.ssi-developer.net/ssi/ssi-date.shtml :D

Ramster
2004-09-12, 09:13 AM
That'll pretty well do it. :)

AcidMaX
2004-09-13, 09:18 AM
Or for PHP you can use something like

<?php echo date("m/d/Y"); ?>

Bill
2004-09-13, 04:14 PM
Two beautiful methods, thanks much Wazza and Acidmax!

I'm a little more familiar with ssi than php, is there anything special that I have to do to get the php method to display on an html page?

(I know that to use the ssi method I have to insert the entries into htaccess to get ssi to display on an html page. I'm guessing there's a similar htaccess entry for php...)

AcidMaX
2004-09-13, 04:27 PM
If php is installed on your webserver (it is on the majority out there). Just save the file with a .php extension and put that code where you want the date and you are all set.

Andy

Opti
2004-09-28, 09:57 AM
Originally posted by Bill
Two beautiful methods, thanks much Wazza and Acidmax!

I'm a little more familiar with ssi than php, is there anything special that I have to do to get the php method to display on an html page?

(I know that to use the ssi method I have to insert the entries into htaccess to get ssi to display on an html page. I'm guessing there's a similar htaccess entry for php...)

this line in .htaccess will make all .html pages be parsed for php

AddType application/x-httpd-php html

or you can force for a particular file like this

<Files filename.html>
ForceType application/x-httpd-php
</Files>