Re: [R] Force conversion of (POSIXct) time zone with base R

2024-08-22 Thread Petr Pikal
Hi what about now <- Sys.time() now [1] "2024-08-22 11:24:23 CEST" now.utc <- as.POSIXct(now, tz = "UTC")+2*3600 now.utc [1] "2024-08-22 11:24:23 UTC" Cheers. Petr čt 22. 8. 2024 v 11:00 odesílatel Iago Giné Vázquez napsal: > Hi, > > How should POSIXct time zone be changed without modifying

Re: [R] Force conversion of (POSIXct) time zone with base R

2024-08-22 Thread Ivan Krylov via R-help
В Thu, 22 Aug 2024 08:59:46 + Iago Giné Vázquez пишет: > How should POSIXct time zone be changed without modifying the > specified time (so fix the time zone). Since POSIXct represents the number of seconds since the specified "epoch" moment (beginning of 1970 UTC), fixing the time zone whi

Re: [R] Force conversion of (POSIXct) time zone with base R

2024-08-22 Thread Iago Giné Vázquez
Thanks all for your comments and solutions! Best regards, Iago De: Ivan Krylov Enviat el: dijous, 22 d��agost de 2024 11:27 Per a: Iago Gin�� V��zquez A/c: r-help@r-project.org Tema: Re: [R] Force conversion of (POSIXct) time zone with base R �� Thu, 22 Aug

Re: [R] Force conversion of (POSIXct) time zone with base R

2024-08-22 Thread Eric Berger
as.POSIXct(as.character(now),tz="UTC") or as.POSIXct(as.character(Sys.time()),tz="UTC") On Thu, Aug 22, 2024 at 12:00 PM Iago Giné Vázquez wrote: > Hi, > > How should POSIXct time zone be changed without modifying the specified > time (so fix the time zone). I tried > > > now <- Sys.time() >

[R] Force conversion of (POSIXct) time zone with base R

2024-08-22 Thread Iago Giné Vázquez
Hi, How should POSIXct time zone be changed without modifying the specified time (so fix the time zone). I tried > now <- Sys.time() > now [1] "2024-08-22 10:56:24 CEST" > as.POSIXct(now, tz = "UTC") [1] "2024-08-22 08:56:24 UTC" > as.POSIXct(now, origin = as.POSIXct("1970-01-01", tz = "UTC"), t