Apologies for the intrusion. I am a lurker on list. I have been working to convert a digitized signal from a matlab file into R for analysis and other applications. R.matlab is working fine, and it is easy to convert the matlab date-time number (days since year 0) into R date-time numbers (seconds since 1970-01-01).
Unfortunately, when I cast the R date-time number into POSIXct format it seems to adjust silently by one hour to reflect daylight savings time, but I have been unable to suppress that behavior. (The problem is that the matlab date is already in MDT, and I don't want to have to write my own code to suppress the added hour only when local DST rules apply.) To use the example of the R date-time number 1340717324, this is the behavior I observe: > as.POSIXct(1340717324,origin='1970-01-01') [1] "2012-06-26 14:28:44 MDT" > as.POSIXct(1340717324,origin='1970-01-01',tz='') [1] "2012-06-26 14:28:44 MDT" > as.POSIXct(1340717324,origin='1970-01-01',tz='America/Denver') [1] "2012-06-26 14:28:44 MDT" > as.POSIXct(1340717324,origin='1970-01-01',tz='MST') [1] "2012-06-26 13:28:44 MST" > as.POSIXct(1340717324,origin='1970-01-01',tz='UTC') [1] "2012-06-26 13:28:44 UTC" I was ultimately able to solve the problem by casting into and out of a character string, but that seems risky/error prone. rdates='%Y-%m-%d %H:%M:%S' > as.POSIXct(strptime(as.character(as.POSIXct(1340717324,origin='1970-01-01',tz='UTC')),format=rdates)) [1] "2012-06-26 13:28:44 MDT" I have read the various help entries and even investigated the lubridates package, but none indicate why exactly the extra hour is being added or how to suppress it. (Note that I tried as.POSIXlt with various settings of isdst, none of which worked). I'm using "R version 2.13.1 (2011-07-08)" on "x86_64-apple-darwin9.8.0". -- ---------------- Samuel Brown [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.