PDA

View Full Version : PHP Time Displaying Inconsistency?


Jimmy T
11-19-2007, 11:41 PM
So I've developed a web page using PHP. It displays the time of it's last update. As I refresh it sometimes it displays time in this format:
Mon Nov 19 19:30:13 2007
Another time it displays it in this format. Why is that??
Mon 19 Nov 2007 07:29:51 PM GMT

Here is the simple code that will not display the same time format:

echo gmstrftime('%c',time());
Why would it change over a span of 5 seconds if I keep reloading the page from this same webhost?

John C
11-19-2007, 11:41 PM
%c picks up the preferred date and time settings which can change. To display the date in the format you always want to see it, you need to define the settings. Take a look at this link to help you: http://www.w3schools.com/php/func_date_gmstrftime.asp