On Fri, 7 Jan 2011, Rustamali Manesiya wrote:
> Hello I have trouble getting my original datetime back see below. I hope I
> am missing something. Please help.
The numeric form (which you should never use) has an origin at
midnight in UTC, not EST.
Note too that 'EST' is not very plausible for your timezone (or are
you in Canada?): see ?Sys.timezone.
> tt <- as.POSIXct(ttn,origin='1970-01-01',tz="UTC")
> attr(tt, "tzone") <- "EST"
> tt
[1] "2011-01-07 07:49:13 EST"
>> tt <- as.POSIXct("2011-01-07 07:49:13",
tz="EST")
>> tt
> [1] "2011-01-07 07:49:13 EST"
>> ttn <- as.numeric(tt)
>> ttn
> [1] 1294404553
>> tt <- as.POSIXct(ttn,origin='1970-01-01',tz="EST")
>> tt
> [1] "2011-01-07 12:49:13 EST"
>>
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at 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.
>
--
Brian D. Ripley, ripley at stats.ox.ac.uk
Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel: +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UK Fax: +44 1865 272595