Jump to content
xisto Community
Sign in to follow this  
sonesay

Php Date() Problem [resolved] date() seems to loop same ninute.

Recommended Posts

My setup is a macbook pro and I have apache+ mysql + php already included I think.

the php is version 4.4.4

I have been using the date() to store dates into my mysql tables in the past and it worked corectly. I dont know what could of happen but now the date() function is returning an incorrect time.

I made a test script test.php

<?php$date_time = date('y-m-d H:m:s');echo($date_time);?>

and loaded it up. My laptops system time would be 1.35.33 PM

and the date and time returned from php would be 07-06-28 13:06:56

I would hit refresh on the browser but it would still loop in that same minute
e.g.

07-06-28 13:06:5607-06-28 13:06:57
07-06-28 13:06:58
07-06-28 13:06:59
07-06-28 13:06:00
07-06-28 13:06:01

.........

Any ideas on how I could fix this problem? would I just be better too to upgrade to lastest version of php and hopefully it will not have that problem.

Share this post


Link to post
Share on other sites

It seems like your PHP.ini isn't set to the correct timezone? It's about 30 minutes off.

Open PHP.ini and search

[Date]

;Defines the default timezone used by the date functions[/br];date.timezone =


and set to the correct timezone. And see if it matches up. Don't forget to remove ";" to be active.

And just in case you were wondering, 13:00 is 1pm in military or 24 hour style. Just pick another time variable to show it as 1:00

Share this post


Link to post
Share on other sites

thanks for info on changing the time zones. there is the other problem with it was it keep repeating the same minute.

07-06-28 13:06:5607-06-28 13:06:57
07-06-28 13:06:58
07-06-28 13:06:59
07-06-28 13:06:00
07-06-28 13:06:01



I noticed that after an hour it would change to
07-06-28 14:06:01 so always stuck on that 6min into the hour. I went a head and tried to download and install php 5 but not very fimilar to mac os x so I googled and found this website. http://forums.xisto.com/no_longer_exists/ downloaded the file PHP 5.2.2 for Apache 1.3 and unzipped and ran it. the installation fails and now apache dont work :E. Right now im trying to get apache back to work so if any mac users fimilar with this problem please help.

Share this post


Link to post
Share on other sites

I think XAMPP is available as a one-click installer for Apache, Mysql and php for OSX. search:XAMPP for the download page and to check whether it will run on your machine.

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.
Sign in to follow this  

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | 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.