|
-
Oct 9th, 2011, 05:02 AM
#1
[RESOLVED] PHP time() gives a different time
Hi guys 
This is the code:
php Code:
echo date( 'D, j M Y, g:i A' , $time());
Output:
Code:
Sun, 9 Oct 2011, 9:58 AM
My System time:
Code:
Sun, 9 Oct 2011, 3:28 PM
How could we resolve this issue ?
I have tested in mySQL by inserting a record using mySQL's "NOW()" function. That's works correctly according to my system time. But in PHP, it is not !
I'm using WAMP server 2.
Thanks 
Edit:
Tested on my webserver:
Code:
Sun, 9 Oct 2011, 5:14 AM --> php's time()
Sun, 9 Oct 2011, 5:14 AM --> sql's now()
Code used:
php Code:
//include_config mysql_connect ($db_host, $db_user, $db_pwd) or die(mysql_error()); mysql_selectdb ($db_database) or die(mysql_error()); $a = time(); echo date( 'D, j M Y, g:i A' , $a); $result = mysql_query("SELECT NOW() as t") or die(mysql_error()); $row = mysql_fetch_array($result); echo "<br />" . date( 'D, j M Y, g:i A' ,strtotime($row['t']));
Last edited by akhileshbc; Oct 9th, 2011 at 05:17 AM.
Reason: added webserver's test results
If my post was helpful to you, then express your gratitude using Rate this Post. 
And if your problem is SOLVED, then please Mark the Thread as RESOLVED (see it in action - video)
My system: AMD FX 6100, Gigabyte Motherboard, 8 GB Crossair Vengance, Cooler Master 450W Thunder PSU, 1.4 TB HDD, 18.5" TFT(Wide), Antec V1 Cabinet
Social Group: VBForums - Developers from India
Skills: PHP, MySQL, jQuery, VB.Net, Photoshop, CodeIgniter, Bootstrap,...
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|