Sys.Date () shows wrong date

I don’t know what happened, but it annoys me. I am now in the GMT-8 time zone. When I type Sys.Date(), it returns the date of tomorrow.

Currently, the current date and time is 12/7/17 10:41 PM: I am typing Sys.time(), and this is what I am getting:

Sys.time()
[1] "2017-12-08 14:37:22 GMT"

Then I try to set my time zone: Sys.setenv(TZ=Sys.timezone())

It clears without errors ... and then again I type Sys.Date()and get

Sys.Date()
[1] "2017-12-08"

It should be 12/7/17 !!

Any help is appreciated.

+5
source share
1 answer

On my Mac system, I saw this with R 3.4.1 after upgrading to Mac OS 10.13.2:

Sys.time()
[1] "2017-12-08 20:52:01 GMT"
Warning:
In as.POSIXlt.POSIXct(x, tz) :
  unknown timezone 'zone/tz/2017c.1.0/zoneinfo/Europe/Berlin'

I could fix it by installing Sys.setenv(TZ = "Europe/Berlin"). Valid time zone names for the United States can be found using grep('^US/', OlsonNames(), value = TRUE).

R 3.4.3 :

Sys.time()
[1] "2017-12-08 21:57:15 CET"

Sys.timezone()
#[1] "Europe/Berlin"

- . , R 3.4.3 :

. macOS 10.13 ‘High Sierra 10.13.1, , R --with-internal-tzcode ( macOS).

+3

Source: https://habr.com/ru/post/1690419/


All Articles