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

Reply

Join Date: Dec 2006
Posts: 20
Reputation: bintang is an unknown quantity at this point 
Solved Threads: 0
bintang bintang is offline Offline
Newbie Poster

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

 
0
  #1
May 27th, 2008
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
Reply With Quote Quick reply to this message  
Join Date: Jan 2008
Posts: 74
Reputation: Vai is an unknown quantity at this point 
Solved Threads: 5
Vai Vai is offline Offline
Junior Poster in Training

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

 
0
  #2
May 27th, 2008
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 <?
  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.
Reply With Quote Quick reply to this message  
Join Date: May 2008
Posts: 13
Reputation: hivenk is an unknown quantity at this point 
Solved Threads: 2
hivenk hivenk is offline Offline
Newbie Poster

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

 
0
  #3
May 27th, 2008
i suggest that
you have to code it using AJAX and use javascript settimeout functions
Reply With Quote Quick reply to this message  
Join Date: May 2008
Posts: 247
Reputation: samarudge is an unknown quantity at this point 
Solved Threads: 19
samarudge samarudge is offline Offline
Posting Whiz in Training

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

 
0
  #4
May 27th, 2008
Dreamweaver can be a bit touchy about some PHP code, The method I use is:
  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
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the PHP Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC