convert timezone

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
User avatar
ddragas
Forum Contributor
Posts: 445
Joined: Sun Apr 18, 2004 4:01 pm

convert timezone

Post by ddragas »

Hi all

can somebody point me in right direction, or even tell me for class or function (that works ok) that can convert date and time from one timezone to another with daylight saving

thank you

kind regards
User avatar
JAB Creations
DevNet Resident
Posts: 2341
Joined: Thu Jan 13, 2005 6:44 pm
Location: Sarasota Florida
Contact:

Re: convert timezone

Post by JAB Creations »

I think this will work for you...change the time zone for your time zone of course which should be like +4:00 or something? I'm not sure off hand.

Code: Select all

$db = mysql_connect("localhost", $truedbuser, $truedbpass);
mysql_query("SET time_zone = '-4:00';");
User avatar
ddragas
Forum Contributor
Posts: 445
Joined: Sun Apr 18, 2004 4:01 pm

Re: convert timezone

Post by ddragas »

thank you for reply
User avatar
Popcorn
Forum Commoner
Posts: 55
Joined: Fri Feb 21, 2003 5:19 am

Re: convert timezone

Post by Popcorn »

don't think that works. it simply sets the timezone of the MySQL session connection, meaning any MySQL fns that are timezone aware will respond offset by 4.

not the same as converting and does not have DST applied.

check http://mysql.oss.eznetsols.org/doc/refm ... pport.html
and viewtopic.php?f=19&t=92892&st=0&sk=t&sd=a
User avatar
ddragas
Forum Contributor
Posts: 445
Joined: Sun Apr 18, 2004 4:01 pm

Re: convert timezone

Post by ddragas »

thank you for reply.

it doesn't have nothing to do with mysql

I've build my own class for converting time

kind regards
Post Reply