[R] Lotos 1-2-3 date to POSIXct
Moffet, Corey
Corey.Moffet at ttu.edu
Mon Apr 29 23:09:09 CEST 2002
Thanks for your response. With a little modification I am getting closer to
the Lotus 1-2-3 results
but not exactly:
Lotus.time <- c(1, 36373.833, 36373.875, 36373.917, 36425.458, 36425.500,
36425.542, 37353.04, 37353.09)
POSIX.time <- ISOdate(1899,12,31,hour=0, tz="")+(Lotus.time)*24*60*60
POSIX.time
which returns:
[1] "1900-01-01 00:00:00 Central Standard Time" # Correct
[2] "1999-08-02 20:59:31 Central Daylight Time" # 1 day and 1 hr fast
[3] "1999-08-02 22:00:00 Central Daylight Time" # 1 day and 1 hr fast
[4] "1999-08-02 23:00:28 Central Daylight Time" # 1 day, 1 hr fast and 1
sec slow
[5] "1999-09-23 11:59:31 Central Daylight Time" # 1 day and 1 hr fast
[6] "1999-09-23 13:00:00 Central Daylight Time" # 1 day and 1 hr fast
[7] "1999-09-23 14:00:28 Central Daylight Time" # 1 day, 1 hr fast and 1
sec slow
[8] "2002-04-07 00:57:35 Central Standard Time" # 1 day fast and 1 sec
slow
[9] "2002-04-07 03:09:35 Central Daylight Time" # 1 day, 1 hr fast and 1
sec slow
but Lotus gives:
unformatted Date Time
1.000 01/01/00 00:00:00
36373.833 08/01/99 19:59:31
36373.875 08/01/99 21:00:00
36373.917 08/01/99 22:00:29
36425.458 09/22/99 10:59:31
36425.500 09/22/99 12:00:00
36425.542 09/22/99 13:00:29
37353.04 04/07/2002 00:57:36
37353.09 04/07/2002 02:09:36
The error in the seconds I am not concerned with. The apparent error in the
hr seems to be
related to Daylight savings not accounted for Lotus 1-2-3. For the range of
data I will be
working with I think I can fix the 1 day error problem but this fix will
have problems between
1 and 36373.833. Is there some exception to the leap year rule in the range
1900 to 1999 that
would explain this discrepancy?
With best wishes and kind regards I am
Sincerely,
Corey A. Moffet
Instructor
Department of Range, Wildlife, and Fisheries Management
Mail Stop 2125
Texas Tech University
Lubbock, Texas 79409-2125
-----Original Message-----
From: Peter Dalgaard BSA [mailto:p.dalgaard at biostat.ku.dk]
Sent: Monday, April 29, 2002 8:18 AM
To: Moffet, Corey
Cc: R-Help (E-mail)
Subject: Re: [R] Lotos 1-2-3 date to POSIXct
"Moffet, Corey" <Corey.Moffet at ttu.edu> writes:
> I have some data that was created for import into a Lotus 1-2-3
spreadsheet
> and on of the columns is time. The
> time is akin to Julian were the value 1 is mapped "01-Jan-00 12:00:00 AM"
in
> Lotus 1-2-3. Is there a function in an R package that can convert this
> numeric vector to a POSIXct vector?
Units are seconds? Subtract 1 and add "01-Jan-00 12:00:00 AM" using
ISOdate. Otherwise convert units, cf:
> ISOdate(2000,1,1)+2000*24*60*60 # 2000 days after the Millennium
[1] "2005-06-23 14:00:00 MET DST"
--
O__ ---- Peter Dalgaard Blegdamsvej 3
c/ /'_ --- Dept. of Biostatistics 2200 Cph. N
(*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk) FAX: (+45) 35327907
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
More information about the R-help
mailing list