[R] time date stamp since, january 1st 1970

David Winsemius dwinsemius at comcast.net
Fri Jan 23 00:34:50 CET 2009


Since the starting date is the same as that of the POSIXct class, it  
should not be a big problem. Just divide by 1000.

 > as.POSIXct(1232558018624/1000, origin="1970-01-01")  # throws an  
error if origin not set
[1] "2009-01-21 17:13:38 EST"
 >
 > as.POSIXct(0/1000, origin="1970-01-01")
[1] "1970-01-01 EST"

-- 
David Winsemius

On Jan 22, 2009, at 5:39 PM, zubin wrote:

> Hello, we are receiving some data, sample below - with a weird time/ 
> date
> stamp format, we need some help with R on converting this time date
> stamp to a useable field in R, date and time in a data-frame.  The
> developer says its the number of milliseconds since midnight,  
> January 1,
> 1970.
>
> sample:  *1232558018624*
> ---------------------
>
>
> How do I interpret the time stamp? Is there a date, i need a date  
> and time.
> site_id 
> ,survey_id 
> ,version_id,survey_start_ts,survey_question_id,start_ts,end_ts,answer
> 2,registration,1,1232558018625,z1,*1232558018624*,*1232558266179*,4
>
>
> Answer: The timestamp is a number representing the exact date and  
> time.
> it is the number of milliseconds since midnight, January 1, 1970. Are
> you using it in the DB or R? I am not sure about R's conversion of
> numbers and dates. is there a way to add a number of seconds or
> milliseconds to a date in R?
>
> 	[[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.




More information about the R-help mailing list