madhu Posted June 7, 2009 Share Posted June 7, 2009 I used the following code snippet and created header.php I used the include option <?php include "header.php"; ?> to to display the date in other page. Yesterday it displayed "Today is June 06, 2009" correctly. But today my system date is June 07 2009. But the pages still display "Today is June 06, 2009". Why it is displaying the old date. Please help me. Code in header.php <div align="center"><font size="4">Welcome to my movie review site!</font> <br> <?php echo "Today is "; echo date("F d"); echo ", "; echo date("Y"); ?> </div> Link to comment https://forums.phpfreaks.com/topic/161236-old-date-displayed/ Share on other sites More sharing options...
XaeroDegreaz Posted June 7, 2009 Share Posted June 7, 2009 Where is your PHP script being ran? If you are running it from your own computer it should be displaying your date. If you are running it from an external server, it will use that server's date. At the time of writing this, it is still June 6th here in the USA, so if you are being hosted by a USA server, then, that date being displayed is quite correct. Link to comment https://forums.phpfreaks.com/topic/161236-old-date-displayed/#findComment-850800 Share on other sites More sharing options...
madhu Posted June 7, 2009 Author Share Posted June 7, 2009 Thanks XaeroDegreaz for a quick reply. I am running it on my own machine. Not on any external server. Link to comment https://forums.phpfreaks.com/topic/161236-old-date-displayed/#findComment-850813 Share on other sites More sharing options...
madhu Posted June 7, 2009 Author Share Posted June 7, 2009 I also have refresh problem, which i reported under http://www.phpfreaks.com/forums/index.php/topic,255562.0.html Both these are interconnected? Link to comment https://forums.phpfreaks.com/topic/161236-old-date-displayed/#findComment-850816 Share on other sites More sharing options...
Ken2k7 Posted June 7, 2009 Share Posted June 7, 2009 If you do the following - echo date('Y-m-d H:i:s'); Does the value change when you refresh the page every 1 second? Link to comment https://forums.phpfreaks.com/topic/161236-old-date-displayed/#findComment-850830 Share on other sites More sharing options...
madhu Posted June 7, 2009 Author Share Posted June 7, 2009 When I use echo date('Y-m-d H:i:s'); time is getting refreshed for every refresh I give. But I noticed one strange thing. When my system time is 1:40 PM, the time displayed in the page 5:40 AM (Now the date displayed is June 07, 2009). How come this difference arise ? Link to comment https://forums.phpfreaks.com/topic/161236-old-date-displayed/#findComment-850910 Share on other sites More sharing options...
Ken2k7 Posted June 7, 2009 Share Posted June 7, 2009 My guess is that your server's timezone is different than the one on your computer. Link to comment https://forums.phpfreaks.com/topic/161236-old-date-displayed/#findComment-851037 Share on other sites More sharing options...
Alex Posted June 7, 2009 Share Posted June 7, 2009 If there's an 8-hour difference and you want it to display your time you can use: date('whatever format', time()+3600*; Link to comment https://forums.phpfreaks.com/topic/161236-old-date-displayed/#findComment-851044 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.