Jump to content

[SOLVED] This may stump some people... timestamp GMT


NoDoze

Recommended Posts

ok, I have a mysql server that has a few databases on it. The server is running on local time (PST), and I need it to be on local time for the databases. However I have one database that needs to have it's timestamp on GMT.

 

Is there a way to make the timestamp for that one DB to be GMT? Currently I have it set to 'on update current_timestamp' and 'current_timestamp'. So it's timestamping when the data is imported.

 

This data is uploading via a URL in this format:

$uweather = "http://domain.com/update.php?ID=username&PASSWORD=password&dateutc=" . $row['timestamp'] . "&tempf=" . $row['airt_f_avg'] . "&winddir=" . $row['winddir'] . "&windspeedmph=" . $row['ws_mph'] . "&windgustmph=" . $row['ws_max'] . "&rainin=" . $row['rain_in_tot'] . "&baromin=" . $row['baro'] . "&dewptf=" . $row['dewpt_f_avg'] . "&humidity=" . $row['rh_avg'] . "&weather=&clouds=&softwaretype=vws%20versionxx&action=updateraw&realtime=1&rtfreq=2.5";

Is there a way I could change the...

$row['timestamp']

...to be reformatted into GMT?

 

 

Hope that makes sense and someone could help me....

Thanks.

Link to comment
Share on other sites

You can set or change the time zone for any/each connection -

 

Per-connection time zones. Each client that connects has its own time zone setting, given by the session time_zone variable. Initially, the session variable takes its value from the global time_zone variable, but the client can change its own time zone with this statement:

 

mysql> SET time_zone = timezone;

 

 

Link to comment
Share on other sites

no...like this:

 

$data = mysql_fetch_array(mysql_query("SELECT NOW()"));
print "Server time (EST) is: {$data[0]}<br />";
mysql_query("SET time_zone = '+0:00'") or die(mysql_error());
$data = mysql_fetch_array(mysql_query("SELECT NOW()"));
print "GMT time is: {$data[0]}<br />";

Server time (EST) is: 2009-01-21 15:19:25
GMT time is: 2009-01-21 20:19:25

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.