 |
|
 |
|
Next: how to express a recursive CTE that returns a bal..
|
| Author |
Message |
External

Since: Nov 24, 2006 Posts: 17
|
(Msg. 1) Posted: Sun Oct 14, 2007 2:54 pm
Post subject: MySQL timezone support - setting from PHP Archived from groups: comp>lang>php (more info?)
|
|
|
|
|
| Back to top |
|
 |  |
External

Since: Sep 02, 2007 Posts: 210
|
(Msg. 2) Posted: Sun Oct 14, 2007 5:59 pm
Post subject: Re: MySQL timezone support - setting from PHP [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
On Sun, 14 Oct 2007 20:54:40 +0200, bill wrote:
> I am using the MySQL date and time functions and they save a lot of my
> time. But the server is located in a time zone 2 hours away. I read in
> the SQL docs how to set the timezone on a per-connection basis, but how
> would I do that from PHP ?
Untested:
mysql_query('SET time_zone = timezone_name');
Where the MySQL manual states:
timezone values can be given in several formats, none of which are case
sensitive:
1. The value 'SYSTEM' indicates that the time zone should be the same as
the system time zone.
2. The value can be given as a string indicating an offset from UTC, such
as '+10:00' or '-6:00'.
3. The value can be given as a named time zone, such as 'Europe/Helsinki',
'US/Eastern', or 'MET'. Named time zones can be used only if the time zone
information tables in the mysql database have been created and populated..
Ideally, you could use:
mysql_query("SET time_zone = '".date_default_timezone_get()."'");
--
Rik Wasmus >> Stay informed about: MySQL timezone support - setting from PHP |
|
| Back to top |
|
 |  |
External

Since: Nov 24, 2006 Posts: 17
|
(Msg. 3) Posted: Tue Oct 16, 2007 9:29 am
Post subject: Re: MySQL timezone support - setting from PHP [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
Rik Wasmus wrote:
> On Sun, 14 Oct 2007 20:54:40 +0200, bill wrote:
>
>> I am using the MySQL date and time functions and they save a lot of my
>> time. But the server is located in a time zone 2 hours away. I read
>> in the SQL docs how to set the timezone on a per-connection basis, but
>> how would I do that from PHP ?
>
> Untested:
> mysql_query('SET time_zone = timezone_name');
>
> Where the MySQL manual states:
> timezone values can be given in several formats, none of which are case
> sensitive:
> 1. The value 'SYSTEM' indicates that the time zone should be the same as
> the system time zone.
> 2. The value can be given as a string indicating an offset from UTC,
> such as '+10:00' or '-6:00'.
> 3. The value can be given as a named time zone, such as
> 'Europe/Helsinki', 'US/Eastern', or 'MET'. Named time zones can be used
> only if the time zone information tables in the mysql database have been
> created and populated.
>
> Ideally, you could use:
> mysql_query("SET time_zone = '".date_default_timezone_get()."'");
>
Thanks RIK, I haven't had time to test it yet, I'll let you know.
bill >> Stay informed about: MySQL timezone support - setting from PHP |
|
| Back to top |
|
 |  |
External

Since: Oct 20, 2007 Posts: 1
|
(Msg. 4) Posted: Sat Oct 20, 2007 4:01 am
Post subject: Re: MySQL timezone support - setting from PHP [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
On Oct 14, 3:10 pm, "Rik Wasmus" wrote:
> On Sun, 14 Oct 2007 20:54:40 +0200, bill wrote:
> > I am using the MySQL date and time functions and they save a lot of my
> > time. But the server is located in a time zone 2 hours away. I read in
> > the SQL docs how to set the timezone on a per-connection basis, but how
> > would I do that from PHP ?
>
> Untested:
> mysql_query('SET time_zone = timezone_name');
tested mysql_query('SET time_zone = US/Eastern');
result: no error, no change at all.
datetime is still two hours off. >> Stay informed about: MySQL timezone support - setting from PHP |
|
| Back to top |
|
 |  |
External

Since: Nov 24, 2006 Posts: 17
|
(Msg. 5) Posted: Sat Oct 20, 2007 7:03 am
Post subject: Re: MySQL timezone support - setting from PHP [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
bill wrote:
> On Oct 14, 3:10 pm, "Rik Wasmus" wrote:
>> On Sun, 14 Oct 2007 20:54:40 +0200, bill wrote:
>>> I am using the MySQL date and time functions and they save a lot of my
>>> time. But the server is located in a time zone 2 hours away. I read in
>>> the SQL docs how to set the timezone on a per-connection basis, but how
>>> would I do that from PHP ?
>> Untested:
>> mysql_query('SET time_zone = timezone_name');
>
> tested mysql_query('SET time_zone = US/Eastern');
> result: no error, no change at all.
> datetime is still two hours off.
>
correction, time is still one hour off - no change.
(it is too early to read an analog clock)
bill >> Stay informed about: MySQL timezone support - setting from PHP |
|
| Back to top |
|
 |  |
| Related Topics: | date.timezone = 'UCT' in php.ini not working - The server I use has PHP Version 4.4.7 and this instruction creates an error: <?php date_default_timezone_set('UCT'); echo date('h:ia');?> php Help advises me to change php.ini instead: date.timezone = 'UCT' However, when I do the time shown se...
Problem with jpg support in gd... - I've a problem using gd to generate jpegs...i did gd_info and found that it's not enabled: { ["GD Version"]=> string(27) "bundled (2.0.28 compatible)" ["FreeType Support"]=> bool(false) ["T1Lib Support"]=&...
when will php support alias name? - When using c++, we could do: using abc = xxx.yyy; // am i right? When using python we could do: import abc.efg as efg When will php support: class My_Best_Class { } define('MyClass', 'My_Best_Class'); $o = new MyClass; // use MyClass as aliasname of..
Tokenizer Support -
how to compile php with new ini setting? - trying to use a.. - I need to add aspell capability to php. I added the following line: extension=libaspell.so The extension directory is: extension_dir = /usr/local/apache2/libexec/modules and I put the aspell cirectories under that like so the extension is actually:... |
|
You can post new topics in this forum You can reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|
|
 |
|
|