If I have a date like this in London time: "2009-06-03 19:30", how can I convert it to the equivalent time in the US West Coast?
+2
A:
First, convert the London time to a POSIXct
object:
pb.txt <- "2009-06-03 19:30"
pb.date <- as.POSIXct(pb.txt, tz="Europe/London")
Then use format
to print the date in another time zone:
> format(pb.date, tz="America/Los_Angeles",usetz=TRUE)
[1] "2009-06-03 11:30:00 PDT"
There are some tricks to finding the right time zone identifier to use. More details in this post at the Revolutions blog: Converting time zones in R: tips, tricks and pitfalls
David Smith
2009-09-08 17:11:57