Jump to content

date function displays the wrong time


johnmerlino1

Recommended Posts

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?

Link to comment
https://forums.phpfreaks.com/topic/290124-date-function-displays-the-wrong-time/
Share on other sites

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.