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.
Thanks

Recommended Answers

All 3 Replies

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:

<?PHP
$Date = date(l);
$Date .= " the ";
$Date .= date(dS);
$Date .= " of ";
$Date .= date(F);
$Date .= " ";
$Date .= date(Y);
print($Date);
?>

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.

Regards,
Sam Rudge

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.