Hi Luke, Thank you for the answer.
On 20/01/2012, at 6:11 , Luke Miller wrote: > 666.1751 sure seems like it should return 2010-10-29 04:12:09 based on > your example. > > 666.1751 days from 2009-01-01 is 2010-10-29 + some hours/min/seconds. > > 0.1751 days * 24 hrs/day = 4.2024 (i.e. 4:00AM + some minutes). > > 0.2024 hours * 60 min/hr = 12.144 (i.e. 12 minutes + some seconds). > > 0.144 minutes * 60 sec/min = 8.64 (i.e. 8.64 seconds). > > Put it all together and I get 2010-10-29 04:12:08.64 in the GMT time > zone. > > What makes you think it should be 2010-10-29 06:12:09? The first fix of the original GPS data is at 06:12:09. So maybe the error is somewhere else? I'm calculating first passage time in R. To run FPT we had to transform DateTime. 1. #paste Date and Time into one column DateTime DT<-paste(GPS$Date, GPS$Time, sep=" ") GPS$DateTime<-as.POSIXct(strptime(as.character(DT), "%d/%m/%Y %H:%M: %S")) #paste it together so that it is in the right format for FPT analysis loc <- GPS[GPS$Bird==bird,c("LON", "LAT", "DateTime", "Bird")] colnames(loc) <- c("Long", "Lat", "gmt", "bird") 2. ##put date in format that FPT likes loc$Date <- (unclass(loc$gmt) - unclass(ISOdatetime(2009, 1, 1, 0, 0, 0, tz = "GMT")))/(24*3600) 3. After running FPT, the date time needs to be transformed back from "666.1751" into "yyyy/mm/dd hh:mm:ss" And I used this function: d$Date <- ISOdatetime(2009, 1, 1, 0, 0, 0, tz = "GMT")+d$Date*(24*3600) where "d" is the FPT output file (previously "loc"). THANKS, Julia > Are you running > into a time zone issue, such as your GPS adjusting its time zone and > reported the time based on the time zone where a reading was taken? If > you crossed between time zones for some of your readings it might > explain the fluctuating difference between the answer you expect and > the answer that ISOdatetime gives you. > > -Luke > > > On Fri, Jan 20, 2012 at 6:59 AM, Sula2011 <julia.so...@gmx.de> wrote: >> >> Dear list, >> >> I need to transform the DateTime of my GPS data from: >> >> "666.1751" into "yyyy/mm/dd hh:mm:ss" >> >> I have the following code: >> >> d$Date <- ISOdatetime(2009, 1, 1, 0, 0, 0, tz = "GMT")+d >> $Date*(24*3600) >> >> This gives me: 2010-10-29 04:12:09, which is wrong. It should be >> 2010-10-29 >> 06:12:09 >> >> Another example: >> >> 418.3219 corresponds to: 2010-02-23 07:43:30, but it should be >> 2010-02-23 >> 08:43:30. >> >> However, not always is the difference + 2 h, it's sometimes less or >> more. >> >> There are a lot of postings here regarding ISOdatetime, but I'm >> still not >> able to solve this . Any ideas or suggestions will be very much >> appreciated. >> >> Best regards, >> >> Julia >> >> PS. I've tried to find the answer in all sorts of R help forums and >> also in >> my R books - no luck so far. Maybe I'm missunderstanding the entire >> ISOdatetime function? >> >> -- >> View this message in context: >> http://r.789695.n4.nabble.com/Incorrect-DateTime-using-ISOdatetime-in-R-tp4313470p4313470.html >> Sent from the R help mailing list archive at Nabble.com. >> >> ______________________________________________ >> R-help@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. Julia Sommerfeld - PhD Candidate Institute for Marine and Antarctic Studies University of Tasmania Private Bag 129, Hobart TAS 7001 Phone: +61 477 289 301 Email: julia.so...@gmx.de julia.sommerf...@utas.edu.au [[alternative HTML version deleted]] ______________________________________________ R-help@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.