time in database in different with my current time

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
chxxangie
Forum Newbie
Posts: 12
Joined: Wed Sep 19, 2007 10:00 pm

time in database in different with my current time

Post by chxxangie »

Code: Select all

 
$upload_date = date('y-m-d'); 
$upload_time = date('G:i:s');
 
when i check from database, i found that the time which is stored into database in not correct.

the time in database is like below:-
2008-11-09 08:31:09 (database data)
2008-11-09 4:34 PM (my pc time)

how to show the time in correctly?
User avatar
JAB Creations
DevNet Resident
Posts: 2341
Joined: Thu Jan 13, 2005 6:44 pm
Location: Sarasota Florida
Contact:

Re: time in database in different with my current time

Post by JAB Creations »

I always found this completely obnoxious. Place this after your database handler...

Code: Select all

mysql_query("SET time_zone = '-4:00';");
Post Reply