RE: Obtaining GMT time in mySQL
My apologies, what I said in this previous post is incorrect. It appeared as if the time was UTC (except for daylight savings) to me, but it was mearly because of the format string As Paul DuBois quite rightly pointed out is that %h in select FROM_UNIXTIME(UNIX_TIMESTAMP(), '%Y %D %M %h:%i:%s %x'); returns the hour in 12hour format, I assumed it was in 24hour format which makes it appear close to UTC in my timezone. Thus select FROM_UNIXTIME(UNIX_TIMESTAMP(), '%Y %D %M %h:%i:%s %x'); does not return GMT time but local time. At 02:13 PM 5/02/2002 +1100, Oliver Mannion wrote: I am close to a solution: select FROM_UNIXTIME(UNIX_TIMESTAMP(), '%Y %D %M %h:%i:%s %x'); UNIX_TIMESTAMP() returns the number of seconds since '1970-01-01 00:00:00' GMT Convert this to a date format and you have a GMT date. Thanks to Chris Land for pointing the UNIX_TIMESTAMP() function out to me. The only prob is daylight savings. We in NSW, Australia are currently in daylight savings and the date returned doesn't accomodate for that. Any one have any ideas why? [mysql] - 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
Obtaining GMT time in mySQL
Hi, 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??? Thanks for your time, Oliver - 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
Re: Obtaining GMT time in mySQL
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 +, 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
RE: Obtaining GMT time in mySQL
I am close to a solution: select FROM_UNIXTIME(UNIX_TIMESTAMP(), '%Y %D %M %h:%i:%s %x'); UNIX_TIMESTAMP() returns the number of seconds since '1970-01-01 00:00:00' GMT Convert this to a date format and you have a GMT date. Thanks to Chris Land for pointing the UNIX_TIMESTAMP() function out to me. The only prob is daylight savings. We in NSW, Australia are currently in daylight savings and the date returned doesn't accomodate for that. Any one have any ideas why? [mysql] - 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
RE: Obtaining GMT time in mySQL
Right. Perl seems to work with daylight savings, how is this? At 08:03 PM 4/02/2002 -0800, James Montebello wrote: UTC doesn't do daylight savings. One reason is that different places do daylight savings at different times. We here in the Western US, for example, are in standard time right now. In Arizona, they don't do daylight savings at all. james montebello On Tue, 5 Feb 2002, Oliver Mannion wrote: I am close to a solution: select FROM_UNIXTIME(UNIX_TIMESTAMP(), '%Y %D %M %h:%i:%s %x'); UNIX_TIMESTAMP() returns the number of seconds since '1970-01-01 00:00:00' GMT Convert this to a date format and you have a GMT date. Thanks to Chris Land for pointing the UNIX_TIMESTAMP() function out to me. The only prob is daylight savings. We in NSW, Australia are currently in daylight savings and the date returned doesn't accomodate for that. Any one have any ideas why? [mysql] - 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