Jump to content

MySql timezone


eugene2009

Recommended Posts

The mysql documentation contains a section on setting the time zone that is used by mysql - http://dev.mysql.com/doc/refman/5.0/en/time-zone-support.html

 

Depending on your access level to the server, you can set it globally on the server or you can set it per-connection (requires that you execute a query like SET time_zone = timezone

before you execute any queries that are time zone specific.)

Link to comment
https://forums.phpfreaks.com/topic/192604-mysql-timezone/#findComment-1014793
Share on other sites

I already read that article but it does not make sense to me because I do not have access to the server..

 

i tried this

$sql = "SELECT *, date_format(date, '%m/%d/%Y at %I:%i %p' )as date FROM comments SET time_zone = America/Los_Angeles WHERE tutorialid='1' ORDER BY commentid DESC LIMIT $offset, $rowsperpage";

 

 

this still doesnt work.. please help

Link to comment
https://forums.phpfreaks.com/topic/192604-mysql-timezone/#findComment-1015144
Share on other sites

$sql1 = "SET time_zone = 'America/Los_Angeles'";
mysql_query($sql1);
$sql2 = "SELECT *, date_format(date, '%m/%d/%Y at %I:%i %p' )as date FROM comments  WHERE tutorialid='1' ORDER BY commentid DESC LIMIT $offset, $rowsperpage";
$result = mysql_query($sql2);

Link to comment
https://forums.phpfreaks.com/topic/192604-mysql-timezone/#findComment-1015210
Share on other sites

date_default_timezone_set('America/Los_Angeles');
$date_format = date("m/d/Y") . " at " . date("I:i") . " " . date("p");
$sql2 = "SELECT *, $date_format as date FROM comments  WHERE tutorialid='1' ORDER BY commentid DESC LIMIT $offset, $rowsperpage";
$result = mysql_query($sql2);

 

See if that works

Link to comment
https://forums.phpfreaks.com/topic/192604-mysql-timezone/#findComment-1016020
Share on other sites

date_default_timezone_set('America/Los_Angeles');
$date_format = date("m/d/Y") . " at " . date("I:i") . " " . date("p");
$sql2 = "SELECT *, $date_format as date FROM comments  WHERE tutorialid='1' ORDER BY commentid DESC LIMIT $offset, $rowsperpage";
$result = mysql_query($sql2);

 

See if that works

 

 

ROTFL

Link to comment
https://forums.phpfreaks.com/topic/192604-mysql-timezone/#findComment-1016030
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

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.