I\'m using the following INSERT statement:
INSERT INTO messages SET `to` = \'\".$to.\"\', `from` = \'\".$this->userid.\"\', `title` = \'\".$title.\"\', `m
After you open the connection to MySQL, run the following as a query:
SET time_zone = timezone;
Then all functions you do will run for that timezone for that connection (i.e. until you close the "link" to the database".
If you have the appropriate permissions you can lock it "permanently" / globaly. Tiemzone strings are standard strings as you have in your question.
http://dev.mysql.com/doc/refman/5.5/en/time-zone-support.html
You would want to go ahead and use the CONVERT_TZ()
function in MySQL. It's based off the Olson database which your operating system uses.
Here is the documentation.
Better use the SQL format directly in your query:
..`created` = CONVERT_TZ(NOW(),'SYSTEM','Asia/Calcutta')..
$myDateTime = new DateTime('2012-05-23 17:01', new DateTimeZone('GMT'));
$myDateTime->setTimezone(new DateTimeZone('Asia/Kolkata'));
echo $myDateTime->format('Y-m-d H:i');
After modification to above code, such as desired format; you could use $myDateTime
variable to insert into database.