I am trying to use the strftime function to make a readable string from my timestamp. My problem is that there is an hour that disappears every time I try to perform a conversion.
I am in Belgium in the summer, so my Linux is set to GMT + 2
jt@jt-roxane:~$ date
lundi 2 juin 2014, 19:18:48 (UTC+0200)
jt@jt-roxane:~$ R
R version 2.14.1 (2011-12-22)
> Sys.time()
[1] "2014-06-02 19:19:46 CEST"
When my friends try to convert the timestamp 1401729132, it translates correctly to
as.POSIXct(1401729132, origin="1970-01-01")
"2014-06-02 19:12:12 CEST"
But when I try to do this, the answer
> as.POSIXct(1401729132, origin="1970-01-01")
[1] "2014-06-02 18:12:12 CEST"
I tried to set the correct time zone, but it does not seem to solve the problem.
> strftime(as.POSIXct(1401729132, origin="1970-01-01"), '%H:%M:%S', tz="UTC-2")
[1] "18:12:12"
Do you have any idea where it came from?
Thanks for any help!
Edit:
I already tried to set the correct TZ in as.POSIXct () - this line gives the wrong answer:
> as.POSIXct(1401729132, origin="1970-01-01", tz="GMT")
[1] "2014-06-02 17:12:12 GMT"