Skip to content
Prev 350321 / 398506 Next

problem setting default timezone

On Thu, Apr 23, 2015 at 8:01 AM, Bos, Roger <roger.bos at rothschild.com>
wrote:
?Doing a ?file.info told me that the mtime variable is a POSIXct value.
Doing a ?as.Date told me that when a POSIXct value is given to it, the time
zone defaults to GMT, _not_ to the local time. That is my interpretation of
the documentation.?


<quote>
The ?as.Date? methods accept character strings, factors, logical
     ?NA? and objects of classes ?"POSIXlt"? and ?"POSIXct"?.  (The
     last is converted to days by ignoring the time after midnight in
     the representation of the time in specified time zone, default
     UTC.)  Also objects of class ?"date"? (from package ?date?) and
     ?"dates"? (from package ?chron?).  Character strings are processed
     as far as necessary for the format specified: any trailing
     characters are ignored.
</quote>

?What I would do is:

as.Date(file.info("..."),tz=getOption("tz"))?