johnmerlino1 Posted July 26, 2014 Share Posted July 26, 2014 First, I would like to say when i tried to recover my account from this website, I took me 10 attempts to get the captcha right and then finally it said it sent me an email to my gmail account. I checked spam folder and everything there was no such email from this site. Then I decided to create a new account, well, it took me another 10 attempts to get the captcha right and finally when it was submitted, the page was loading for around 3 minutes before it signed me in. My question is about the php date() function. It accepts a format to display a time. In the following example I use F for full representation of month, d for 2-digit day of month with leading zeros, Y for full year, g for 12-hour format without leading 0s, s for seconds and A for meridiem. It uses the correct format, but it gives me the wrong time. My local time is 4:43 and it prints out 4:12: <?php echo "<p>order processed on " . date("F d, Y g:sA") . "</p>";?> Why is it 30 minutes behind? Quote Link to comment https://forums.phpfreaks.com/topic/290124-date-function-displays-the-wrong-time/ Share on other sites More sharing options...
fastsol Posted July 26, 2014 Share Posted July 26, 2014 Are you doing this on localhost or a web host? If on a webhost, the time will depend on what the server time is set to and where the server is actually located in the world. Quote Link to comment https://forums.phpfreaks.com/topic/290124-date-function-displays-the-wrong-time/#findComment-1486196 Share on other sites More sharing options...
johnmerlino1 Posted July 26, 2014 Author Share Posted July 26, 2014 Are you doing this on localhost or a web host? If on a webhost, the time will depend on what the server time is set to and where the server is actually located in the world. I'm running this on localhost on Ubuntu 12.04 desktop, using php5 and apache2 from the repositories (apt-get). Quote Link to comment https://forums.phpfreaks.com/topic/290124-date-function-displays-the-wrong-time/#findComment-1486199 Share on other sites More sharing options...
fastsol Posted July 26, 2014 Share Posted July 26, 2014 Try restarting all the server services. I have had a issue with time being off on a dedicated webhost server before until I restarted everything. Beyond that, I don't know. Quote Link to comment https://forums.phpfreaks.com/topic/290124-date-function-displays-the-wrong-time/#findComment-1486200 Share on other sites More sharing options...
Solution mac_gyver Posted July 27, 2014 Solution Share Posted July 27, 2014 how do you know the display is 30 minutes behind, since you are not displaying the minutes? Quote Link to comment https://forums.phpfreaks.com/topic/290124-date-function-displays-the-wrong-time/#findComment-1486203 Share on other sites More sharing options...
johnmerlino1 Posted July 27, 2014 Author Share Posted July 27, 2014 how do you know the display is 30 minutes behind, since you are not displaying the minutes? You I think you are right. I was displaying seconds not minutes. Quote Link to comment https://forums.phpfreaks.com/topic/290124-date-function-displays-the-wrong-time/#findComment-1486204 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.