Reputation: 178
I'm facing problem to get timezone of Linux server from R code. See code below, what I was given is:
Sys.time()
[1] "2016-03-18 11:20:11 IST"
Sys.timezone()
[1] NA
In the above situation I got timezone including with date and time, when I was given Sys.time(). But individually I couldn't get timezone.
I want timezone of Linux server with out setting timezone. Any help would be greatly appreciated. Thank you!
Upvotes: 2
Views: 179
Reputation: 23788
There seems to be a problem sometimes with Sys.timezone()
. The result depends on settings of the system, and the OS may run on a different locale than R. In any case, I obtain the same NA
result on my Linux machine.
As a workaround, try
format(Sys.time(), format="%Z")
or
as.POSIXlt(Sys.time())$zone
Upvotes: 2