943,840 Members | Top Members by Rank

Ad:
  • PHP Discussion Thread
  • Unsolved
  • Views: 1197
  • PHP RSS
May 27th, 2008
0

What's the code of making the day and date automatically updated

Expand Post »
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
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
bintang is offline Offline
20 posts
since Dec 2006
May 27th, 2008
0

Re: What's the code of making the day and date automatically updated

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 Syntax (Toggle Plain Text)
  1. <?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.
Vai
Reputation Points: 12
Solved Threads: 5
Junior Poster in Training
Vai is offline Offline
74 posts
since Jan 2008
May 27th, 2008
0

Re: What's the code of making the day and date automatically updated

i suggest that
you have to code it using AJAX and use javascript settimeout functions
Reputation Points: 10
Solved Threads: 2
Newbie Poster
hivenk is offline Offline
13 posts
since May 2008
May 27th, 2008
0

Re: What's the code of making the day and date automatically updated

Dreamweaver can be a bit touchy about some PHP code, The method I use is:
PHP Syntax (Toggle Plain Text)
  1. <?PHP
  2. $Date = date(l);
  3. $Date .= " the ";
  4. $Date .= date(dS);
  5. $Date .= " of ";
  6. $Date .= date(F);
  7. $Date .= " ";
  8. $Date .= date(Y);
  9. print($Date);
  10. ?>
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
Reputation Points: 26
Solved Threads: 31
Posting Whiz
samarudge is offline Offline
354 posts
since May 2008

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in PHP Forum Timeline: PHP / Flash Variable Email Script Format Question
Next Thread in PHP Forum Timeline: problem with select statement filter thru GET url...





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC