You *could* use UNIX_TIMESTAMP(NOW()), which will return an integer
timestamp from the server in standard Unix time, which is the number of
seconds since 00h00 1 Jan 1970 UTC.  However, there is no easy way to
get this to display in YYYY-MM-DD HH:MM:SS format w/o the conversion to
local time taking place.  I also have no idea if this will work correctly
on a non-Unix platform, as I've never used MySQL on anything but Linux
and Solaris.

Setting the TZ variable on the server will the right thing, but all times
on the box will be in UTC, not just some of them, which is probably not
what you want.  

james montebello

On Tue, 5 Feb 2002, Oliver Mannion wrote:

> Hi dn,
> 
> Right. Having said that tho, is there a function
> in mysql that will return the GMT time from the operating
> system, that I can subsequently use in a query.
> I could use the GMT time from the db client but I
> would prefer to use the GMT time from the operating
> system mySQL is running on.
> 
> Thanks
> Oliver 
> 
> At 12:35 AM 5/02/2002 +0000, DL Neil wrote:
> >Hi Oliver,
> >
> >> I would like to obtain the time in GMT in mySQL.
> >>
> >> CURRENT_TIMESTAMP returns the local time
> >> SHOW VARIABLES returns a list of variables, one being TZ which is "EST" on
> >> my system
> >>
> >> But how can I get the time in GMT???
> >
> >
> >MySQL is time-neutral, that is to say, if you ask it the time, it will ask
> the server OpSys.
> >
> >As my mother used to say, "you only get out of something, what you put
> into it"! If you declare a date/time
> >column, any data you INSERT will have the same value when you subsequently
> SELECT it. It's up to you to
> >determine which time zone to use when representing your data.
> >
> >Are you accessing MySQL from some other facility, eg PHP? Can you use that
> tool to acquire/restate the temporal
> >data?
> >
> >Regards,
> >=dn
> >
> >
> >
> >
> 
> ---------------------------------------------------------------------
> Before posting, please check:
>    http://www.mysql.com/manual.php   (the manual)
>    http://lists.mysql.com/           (the list archive)
> 
> To request this thread, e-mail <[EMAIL PROTECTED]>
> To unsubscribe, e-mail <[EMAIL PROTECTED]>
> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
> 


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to