Some code [Software]
Hi Dr Anonymous 
So you are an advanced RUser!
Welcome. Didn’t know it until yesterday either.
In many countries. In Austria it is not just a norm but legally binding. Rarely used in daily life.
I was curious myself. My latest code:
Which gave on my machine:
Note the different local times: Poughkeepsie changed EST ↑ EDT on March 10th, Austria will change CET ↑ CEST on March 31th, and New Zealand will change NZDT ↓ NZT on April 7th.
See this funny story.

❝ I agree, patience is the key :), I use R studio predominantly and have a GitHub account (need to be more active though).
So you are an advanced RUser!
❝ ❝ ....This is the number of seconds since midnight, January 1, 1960…
❝
❝ Woah, thanks for the explanation.
Welcome. Didn’t know it until yesterday either.
❝ […] I believed ISO8601 was majorly the standard time format
In many countries. In Austria it is not just a norm but legally binding. Rarely used in daily life.
❝ Thanks for working it out, I tried replicating this and this looks promising for me to try it out further.
I was curious myself. My latest code:
library(lubridate) # Makes job easier but has large footprint. See also:
# https://blog.revolutionanalytics.com/2009/06/converting-time-zones.html
# https://www.gormanalysis.com/blog/dates-and-times-in-r-without-losing-your-sanity/
# https://stackoverflow.com/questions/51236962/how-to-format-a-difftime-object-to-a-string-with-hhmmss
# For a list of abbreviated locations / time zones: OlsonNames()
# or https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
# I recommend to give the location; if applicable it will observe
# local daylight time switches. In case you are lost, retrieve the location
# R is running in: Sys.timezone()
lct <- Sys.getlocale("LC_TIME") # Save original locale.
invisible(Sys.setlocale("LC_TIME", "C"))
my_tz <- 'Europe/Vienna'
my_time <- now(tzone=my_tz)
IBM_tz <- 'US/Eastern'
IBM_time <- with_tz(my_time, IBM_tz)
your_tz <- 'Asia/Kolkata'
your_time <- with_tz(my_time, your_tz)
NZ_tz <- 'Pacific/Auckland'
NZ_time <- with_tz(my_time, NZ_tz)
tz <- c(my_tz, IBM_tz, your_tz, NZ_tz)
dt <- c(as.character(my_time), as.character(IBM_time),
as.character(your_time), as.character(NZ_time))
UTC.dt <- offset <- rep(NA, length(dt))
for (j in seq_along(dt)) { # Cannot be vectorized!
dt[j] <- format(as.POSIXct(dt[j], tz=tz[j]), tz=tz[j], usetz=TRUE)
UTC.dt[j] <- format(as.POSIXct(dt[j], tz=tz[j]), tz='UTC', usetz=TRUE)
x <- as.numeric(difftime(dt[j], UTC.dt[j], units="hours"))
offset[j] <- sprintf("%+02d:%02d", x %/% 1, (x - x %/% 1)*60)
}
df <- data.frame(location=tz, local.datetime=dt, offset, UTC.datetime=UTC.dt,
loc.SAS.datetime=format(as.POSIXct(strptime(dt,
format='%F %T')), format='%d%b%y:%H:%M:%S'),
UTC.SAS.datetime=format(as.POSIXct(strptime(UTC.dt,
format='%F %T')), format='%d%b%y:%H:%M:%S'),
row.names=NULL, stringsAsFactors=FALSE)
invisible(Sys.setlocale("LC_TIME", lct)) # Restore original locale.
print(df, row.names=FALSE) # Here we are.
Which gave on my machine:
location local.datetime offset UTC.datetime loc.SAS.datetime UTC.SAS.datetime
Europe/Vienna 2019-03-22 18:32:57 CET +1:00 2019-03-22 17:32:57 UTC 22Mar19:18:32:57 22Mar19:17:32:57
US/Eastern 2019-03-22 13:32:57 EDT -4:00 2019-03-22 17:32:57 UTC 22Mar19:13:32:57 22Mar19:17:32:57
Asia/Kolkata 2019-03-22 23:02:57 IST +5:30 2019-03-22 17:32:57 UTC 22Mar19:23:02:57 22Mar19:17:32:57
Pacific/Auckland 2019-03-23 06:32:57 NZDT +13:00 2019-03-22 17:32:57 UTC 23Mar19:06:32:57 22Mar19:17:32:57
Note the different local times: Poughkeepsie changed EST ↑ EDT on March 10th, Austria will change CET ↑ CEST on March 31th, and New Zealand will change NZDT ↓ NZT on April 7th.
See this funny story.
—
Dif-tor heh smusma 🖖🏼 Довге життя Україна!![[image]](https://static.bebac.at/pics/Blue_and_yellow_ribbon_UA.png)
Helmut Schütz
![[image]](https://static.bebac.at/img/CC by.png)
The quality of responses received is directly proportional to the quality of the question asked. 🚮
Science Quotes
Dif-tor heh smusma 🖖🏼 Довге життя Україна!
![[image]](https://static.bebac.at/pics/Blue_and_yellow_ribbon_UA.png)
Helmut Schütz
![[image]](https://static.bebac.at/img/CC by.png)
The quality of responses received is directly proportional to the quality of the question asked. 🚮
Science Quotes
Complete thread:
- CDISC datasets or R. Acceptable ?? WhiteCoatWriter 2019-03-21 07:13 [Software]
- CDISC datasets from R. Why not? Helmut 2019-03-21 10:47
- CDISC datasets from R. Why not? WhiteCoatWriter 2019-03-21 12:13
- CDISC datasets from R. Why not? Helmut 2019-03-21 16:43
- CDISC datasets from R. Why not? WhiteCoatWriter 2019-03-22 06:56
- Some codeHelmut 2019-03-22 16:58
- Some code WhiteCoatWriter 2019-03-24 07:59
- SAS only? Helmut 2019-03-24 12:34
- SAS only? WhiteCoatWriter 2019-03-25 09:39
- Confusing… Helmut 2019-03-25 13:44
- Confusing… WhiteCoatWriter 2019-03-27 06:55
- Confusing… Helmut 2019-03-25 13:44
- SAS only? WhiteCoatWriter 2019-03-25 09:39
- SAS only? Helmut 2019-03-24 12:34
- Some code WhiteCoatWriter 2019-03-24 07:59
- Some codeHelmut 2019-03-22 16:58
- CDISC datasets from R. Why not? WhiteCoatWriter 2019-03-22 06:56
- CDISC datasets from R. Why not? Helmut 2019-03-21 16:43
- CDISC datasets from R. Why not? WhiteCoatWriter 2019-03-21 12:13
- CDISC datasets from R. Why not? Helmut 2019-03-21 10:47