Skip to content
Prev 82145 / 398503 Next

Automatic time zone conversion

Note that even that will not reliably work on all platforms.  The
only values for the tz= argument that reliably work across
platforms are tz = "" and tz = "GMT".  (See RNews 4/1 Help Desk.)
In fact, entering the above code into my machine

	> R.version.string  # Windows XP
	[1] "R version 2.2.0, 2005-10-24"

gives a different answer than on your machine:

	> as.POSIXct(as.character(strptime(cdate,format="%Y-%m-%d_%H:%M:%S")),
	+	tz="CST")+(8*3600)
	[1] "2000-05-11 08:00:00 CST"

Also if by CST you mean Central Standard Time as in Chicago, Houston
and Winnipeg then its not 8 hours from GMT.  See:

	http://www.stacken.kth.se/~kvickers/timezone.html


Could it be that you just want to read it in as GMT but
display it in the current time zone?  If so, try this:

	x <- as.POSIXct(chartr("_", " ", cdate), tz = "GMT")
	attr(x, "tzone") <- NULL
On 12/5/05, simon <sentientc at gmail.com> wrote: