[R] Different time between date() and Sys.date()

Uwe Ligges ligges at statistik.tu-dortmund.de
Sat Oct 23 17:41:42 CEST 2010



On 21.10.2010 19:53, David Winsemius wrote:
>
> On Oct 21, 2010, at 11:59 AM, omerle wrote:
>
>> Thanks for you answer.
>> It s sufficient but I d like to know why my system think I am CEST and
>> yours think your are EDT.
>
> It probably acquired it from your OS at the time of R's installation.

No, the OS setting when R was started is used.

Uwe



> (And that was not correct as I discovered.)
>
>> Can I change it ?
>
> Of course. (But not necessarily the way I would have predicted.)
>
> ?Sys.setlocale
>
>  > Sys.getlocale()
> [1] "en_US.UTF-8/en_US.UTF-8/C/C/en_US.UTF-8/en_US.UTF-8"
>
> The arguments (and LC_TIME is but one of the arguments) are system
> dependent and you have not supplied that information. Furthermore, my
> efforts at changing my system (Mac 10.5.7/R2.11.1) were not successful.
>
>  > Sys.setlocale(category = "LC_ALL" , locale= "de_DE")
> [1] "de_DE/de_DE/de_DE/C/de_DE/en_US.UTF-8"
>  > date()
> [1] "Thu Oct 21 13:35:33 2010"
>  > Sys.time()
> [1] "2010-10-21 13:35:39 EDT"
>
> ?Sys.timezone
>
> Made it clear that it is an OS setting and changing it in my system does
> the trick:
>
>  > Sys.time()
> [1] "2010-10-21 19:48:42 CEST"
>



More information about the R-help mailing list