Hi, I have date and time in a format like this: " 2007-02-21 05:19:00". Do you which function i can use to derterminate the difference in time between this value and an other one. For exemple: this one : 2007-02-21 05:19:00 and this one : 2007-02-20 14:21:53 Thanks a lot, Karine H. _________________________________________________________________ [[elided Hotmail spam]] [[alternative HTML version deleted]]
dd = as.POSIXlt(c("2007-02-21 05:19:00", "2007-02-20 14:21:53"), format="%Y-%m-%d %H:%M:%S") dd[1]-dd[2] b On Tue, Feb 23, 2010 at 2:48 PM, karine heerah <karine.heerah at hotmail.fr> wrote:> > Hi, > > > > I have date and time in a format like this: " 2007-02-21 05:19:00". > > Do you which function i can use to derterminate the difference in time between this value and an other one. > > For exemple: > > > > this one : 2007-02-21 05:19:00 > > and this one : 2007-02-20 14:21:53 > > > > Thanks a lot, > > Karine H. > > > > > > > _________________________________________________________________ > [[elided Hotmail spam]] > > ? ? ? ?[[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. >
Hi Karine, time1 <- as.POSIXct("2007-02-21 05:19:00") time2 <- as.POSIXct("2007-02-20 14:21:53") difftime(time1, time2) should get you started. -Ista On Tue, Feb 23, 2010 at 9:48 AM, karine heerah <karine.heerah at hotmail.fr> wrote:> > Hi, > > > > I have date and time in a format like this: " 2007-02-21 05:19:00". > > Do you which function i can use to derterminate the difference in time between this value and an other one. > > For exemple: > > > > this one : 2007-02-21 05:19:00 > > and this one : 2007-02-20 14:21:53 > > > > Thanks a lot, > > Karine H. > > > > > > > _________________________________________________________________ > [[elided Hotmail spam]] > > ? ? ? ?[[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. >-- Ista Zahn Graduate student University of Rochester Department of Clinical and Social Psychology http://yourpsyche.org
See R News 4.1 and particularly the table at the end of the relevant article. On Tue, Feb 23, 2010 at 9:48 AM, karine heerah <karine.heerah at hotmail.fr> wrote:> > Hi, > > > > I have date and time in a format like this: " 2007-02-21 05:19:00". > > Do you which function i can use to derterminate the difference in time between this value and an other one. > > For exemple: > > > > this one : 2007-02-21 05:19:00 > > and this one : 2007-02-20 14:21:53 > > > > Thanks a lot, > > Karine H. > > > > > > > _________________________________________________________________ > [[elided Hotmail spam]] > > ? ? ? ?[[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. >