Freelancers Network
 
skill list top cap
Homepage
Join the Freelancer's Network
Update your details
Find a freelancer
Post a project
Find a project
Projects Archive
Post a job
Find a job
Jobs Archive
See Dan's Pages
See Andy's Pages
Link to this site
Resources
Join/Leave Forum
Forum Messages
+Additions+ Adverts
Advertising
Contact Us
Subscribe to our newsletter - enter your email address and hit return
Freelancers.net is owned and operated by Andy Stowell and Dan Winchester
skill list end cap
guru web hostcom

Find me again on Freelancers.net

Re: FN-FORUM: Getting GMT with MySQL NOW()

date posted 11th May 2008 18:00

It works a treat. Thanks Owen.

Vicki

Owen Smith wrote:
> This might work (dst date differences allowing)
>
> SELECT DATE_ADD(NOW(), INTERVAL 2 HOUR);
>
> which will give you an EST date result. For a result in PST, you would do:
>
> SELECT DATE_SUB(NOW(), INTERVAL 1 HOUR);
>
> If you are working with time in seconds instead of dates, then factor in the
> offset in seconds. Because there are 3600 seconds in an hour, and EST is 2
> hours later than MST, the following converts timestamps from MST to EST:
>
> SELECT unix_timestamp() + (3600 * 2);
>
> SELECT FROM_UNIXTIME(UNIX_TIMESTAMP() + (3600 * 2));
>
> Cheers
>
> Owen
>
> -----Original Message-----
> From: [EMAIL REMOVED] [EMAIL REMOVED] On Behalf Of Vicki
> Sivess
> Sent: 11 May 2008 18:44
> To: FN-FORUM / [EMAIL REMOVED]
> Subject: FN-FORUM: Getting GMT with MySQL NOW()
>
>
> Does anyone know how the MySQL NOW() function can be made to use GMT
> instead of the server time? A site I am doing some work on has just been
> moved onto a server in America. The environment varaible has been set in
> PHP (putenv("TZ=Europe/London");) but in the SQL queries NOW() is
> returning East coast of America time.
>
> According to the manual, we need to set the system time zone for the
> MySQL Server at startup. It gives two options: one is to set it with the
> --timezone=timezone_name option to mysqld_safe.
>
> The guy who is running the server doesn't seem very sure about this, and
> anyway as it is not a dedicated server, I don't know if he will be able
> to run the mysql demon.
>
> Does anyone know of another (simpler) way of doing this?
>
> Thanks,
>
> Vicki
>
>
>



Messages by Day
May 31st 2008
May 30th 2008
May 29th 2008
May 28th 2008
May 27th 2008
May 26th 2008
May 25th 2008
May 24th 2008
May 23rd 2008
May 22nd 2008
May 21st 2008
May 20th 2008
May 19th 2008
May 18th 2008
May 17th 2008
May 16th 2008
May 15th 2008
May 14th 2008
May 13th 2008
May 12th 2008
May 11th 2008
May 10th 2008
May 9th 2008
May 8th 2008
May 7th 2008
May 6th 2008
May 5th 2008
May 4th 2008
May 3rd 2008
May 2nd 2008
May 1st 2008


Messages by Month
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008


Messages by Year
2008
2007
2006
2005
2004
2003
2002
2001
2000