Thomas Lumley <[EMAIL PROTECTED]> writes:

> On Mon, 3 Feb 2003, John Bjornar Bremnes wrote:
> 
> > A colleague of mine would like to know how seconds since 1970
> > (represented as integers) can be converted to date-time objects?
> 
> ISOdate(1970,1,1)+seconds

I think you might want 

ISOdate(1970,1,1,hour=0)+1:100

to get it to count from midnight, GMT.

Notice that there are devils lurking in using class(x)<-

> class(ISOdate(1970,1,1,hour=0)+1:100)
[1] "POSIXt"  "POSIXct"

so that's what you need to set class(x) to. Without the "POSIXt" bit
you may run into method dispatch problems later on. Currently, that
is! Relying on the internal representation of a class is generally to
be avoided.


-- 
   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - ([EMAIL PROTECTED])             FAX: (+45) 35327907

______________________________________________
[EMAIL PROTECTED] mailing list
http://www.stat.math.ethz.ch/mailman/listinfo/r-help

Reply via email to