IPB

Welcome Guest ( Log In | Register )



Tags
This content has not been tagged yet
 
Closed TopicStart new topic

Php Date() Problem [resolved]

date() seems to loop same ninute.


sonesay
no avatar
|||[ n00b King ]|||
*********
Group: Members
Posts: 924
Joined: 20-June 07
From: Auckland
Member No.: 45,102
myCENT:13.12



Post #1 post Jun 28 2007, 01:39 AM
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

CODE
<?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.
QUOTE
07-06-28 13:06:56
07-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.
Go to the top of the page
+Quote Post
BuffaloHelp
no avatar
Sterling Archer
******************
Group: Admin
Posts: 3,978
Joined: 23-April 05
From: Trap17 storage box
Member No.: 6,042
myCENT:29.60



Post #2 post Jun 28 2007, 02:36 AM
It seems like your PHP.ini isn't set to the correct timezone? It's about 30 minutes off.

Open PHP.ini and search
QUOTE
[Date][br];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
Go to the top of the page
+Quote Post
sonesay
no avatar
|||[ n00b King ]|||
*********
Group: Members
Posts: 924
Joined: 20-June 07
From: Auckland
Member No.: 45,102
myCENT:13.12



Post #3 post Jun 28 2007, 04:51 AM
thanks for info on changing the time zones. there is the other problem with it was it keep repeating the same minute.

QUOTE
07-06-28 13:06:56
07-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://www.entropy.ch/software/macosx/php/ 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.
Go to the top of the page
+Quote Post
jlhaslip
no avatar
Insert Custom Title Here
*********************
Group: [MODERATOR]
Posts: 5,022
Joined: 24-July 05
From: Linux, DOS and Windows…the good, the bad and the ugly
Member No.: 9,787
Spam Patrol
myCENT:80.40



Post #4 post Jun 28 2007, 05:22 AM
I think XAMPP is available as a one-click installer for Apache, Mysql and php for OSX. [google]XAMPP[/google] for the download page and to check whether it will run on your machine.
Go to the top of the page
+Quote Post
sonesay
no avatar
|||[ n00b King ]|||
*********
Group: Members
Posts: 924
Joined: 20-June 07
From: Auckland
Member No.: 45,102
myCENT:13.12



Post #5 post Jun 28 2007, 10:35 AM
Thanks XAMMP is very easy to install, now I can get back to building my site ^^
Go to the top of the page
+Quote Post

Closed TopicStart new topic

Collapse

> Similar Topics

    Topic Title Replies Topic Starter Views Last Action
No New Posts   2 (G)Pradeep Yadav 496 29th August 2009 - 12:04 PM
Last post by: minimcmonkey
No New Posts   5 bluedragon 2,635 17th October 2009 - 02:34 PM
Last post by: iG-drew
No new   18 Panzer 2,925 28th September 2009 - 01:30 AM
Last post by: jlhaslip
No New Posts   11 velma 2,325 14th August 2009 - 12:14 PM
Last post by: sheepdog
No New Posts 4 hatebreed 9,965 10th August 2004 - 11:10 AM
Last post by: hatebreed
No New Posts   1 mmbg 7,344 13th August 2004 - 06:01 PM
Last post by: odomike
No New Posts   6 saitunes 1,788 20th November 2009 - 03:43 AM
Last post by: iG-harsh
No New Posts   1 SilverBoarder 8,912 17th August 2004 - 04:05 PM
Last post by: odomike
No New Posts   3 Mario 7,596 21st August 2004 - 01:31 PM
Last post by: X3r0X
No New Posts   3 Vacant 8,108 26th August 2004 - 09:09 AM
Last post by: Vacant
No New Posts   9 Eric Straven 9,023 29th August 2004 - 07:28 PM
Last post by: wassie
No New Posts 11 dizilluziondmasokist 6,351 22nd March 2005 - 03:25 AM
Last post by: gdpglc
No New Posts   7 truvu17 8,503 1st May 2006 - 03:20 PM
Last post by: shadowx
No New Posts   3 GhostKillerX 6,975 24th September 2004 - 01:01 AM
Last post by: akz
No New Posts   1 truvu17 8,593 21st September 2004 - 09:12 AM
Last post by: OpaQue


 



RSS Open Discussion Time is now: 18th March 2010 - 02:27 AM

Web Hosting Powered by ComputingHost.com.
Xisto.com : HONESTY ROCKS! truth rules.
Creative Commons License