I have made the code of php to Dreamweaver. that codes are containing of date and day. But Seems Dreamweaver can't identify the code of php...
This is my php code that I put into Dreamweaver:

<? print(Date("l F d, Y")); ?>

Anyone knows what is the code of making date and day automatically updated in php?

PS: I click Insert -> Date (and choose the date and day) but it didn't work.

Please help me soon.

8 Years
Discussion Span
Last Post by samarudge

First of all your code works just fine. The day and time will change when the server it's on day/time changes.

Secondly, I recommend inserting php after the <?

<?php print(Date("l F d, Y"));  ?>

As far as dreamweaver is concerned, I don't know I don't use it. Sorry I cannot help you there.


i suggest that
you have to code it using AJAX and use javascript settimeout functions


Dreamweaver can be a bit touchy about some PHP code, The method I use is:

$Date = date(l);
$Date .= " the ";
$Date .= date(dS);
$Date .= " of ";
$Date .= date(F);
$Date .= " ";
$Date .= date(Y);

As you can see I have added things like 'the' and some spaces so the full date will look like this:
Tuesday the 27th of May 2008
And you could add in a refresh tag if you wanted it to stay updated properly.
The insert date function in Dreamweaver just inserts the date at the time you enter it not dynamically.
You could do what hivenk sugests and write some AJAX or Javascript but that would display the clients date where as the date() command will always show the server date so you can make sure it is always correct.

Sam Rudge

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.