0

I want to convert time in Japan timezone to time in GMT. However, it doesnot work.

> a=strptime("2017-01-01 12:01:02",format="%Y-%m-%d %H:%M:%S",tz="Japan")
> a 
[1] "2017-01-01 12:01:02 JST"
> attr(a, "tzone") <- "GMT"
> a
[1] "2017-01-01 12:01:02 JST" 
jinji2100
  • 1
  • 1

2 Answers2

1

You can use lubridate:

library(lubridate)
with_tz(a, "GMT")

#"2017-01-01 03:01:02 GMT"
J_F
  • 9,956
  • 2
  • 31
  • 55
0

Try to read this post: Converting time zones

require(lubridate)

now = Sys.time()

with_tz(now, 'GMT')

V. Gai
  • 450
  • 3
  • 9
  • 30