[R] time zone conversion

2008-04-28 Thread McGehee, Robert
Hello, I'm trying to convert times in the EST/EDT (New York) format to times in the GMT/BST (London) and UTC+9 format (Tokyo). That is, if I know what time it is in New York, what is local time in London and Tokyo? Ex: Here's the conversion from New York EST/EDT time to London's GMT/BST time

Re: [R] time zone conversion

2008-04-28 Thread McGehee, Robert
Well, I'll go ahead and (partially) answer my own question. This seems to do the trick for Britain: as.POSIXlt(as.POSIXct(2007-04-01 12:00:00), tz=GB) [1] 2007-04-01 17:00:00 BST (And it also points out that I got my conversions wrong in my toy example!) I had originally tried this by setting

Re: [R] time zone conversion

2008-04-28 Thread Prof Brian Ripley
The POSIXct/lt functions do this (provided your OS is up to it). x - c(2007-03-01 12:00:00, 2007-03-15 12:00:00, 2007-04-01 12:00:00) xx - as.POSIXct(x, tz=EST5EDT) format(xx, tz=Europe/London) [1] 2007-03-01 17:00:00 2007-03-15 16:00:00 2007-04-01 17:00:00 format(xx, %Y-%m-%d