search for: dlstime

Displaying 1 result from an estimated 1 matches for "dlstime".

Did you mean: daytime
2006 Oct 27
2
POSIXct time zone and daylight savings issues
Hello, Suppose we need a function that takes a POSIXct object and need to calculate the time difference between it and GMT time: gmtDiff <- function(time) { time.gmt <- as.POSIXct(format(time, tz="GMT")) time.plt <- as.POSIXlt(time) dlstime <- ifelse(time.plt$isdst > 0, 1, 0) timezone <- as.numeric(difftime(time, time.gmt, units="hours")) timezone - dlstime } Please note this assumes no daylight savings if the 'isdst' component for the POSIXlt object is negative (i.e. don't know if DST is in ef...