[R] Compare date Oracle with Sys.time

arun smartpink111 at yahoo.com
Fri Jul 6 18:04:40 CEST 2012


Not quite understand about ur problem.  Could you dput your data?

The below should be general format to convert to class date

 now_7<-format(Sys.time()-(7*60*60*24), "%Y-%m-%d 00:00:00")
> now_7
[1] "2012-06-29 00:00:00"
> class(now_7)
[1] "character"
now_7_new<-as.Date(Sys.time()-(7*60*60*24), format="%Y-%m-%d %H:%M:%S")
> now_7_new
[1] "2012-06-29"
> class(now_7_new)
[1] "Date"


----- Original Message -----
From: cindy.dol <cindy.dolomieu at insa-lyon.fr>
To: r-help at r-project.org
Sent: Friday, July 6, 2012 11:50 AM
Subject: [R] Compare date Oracle with Sys.time

I would like to import only datas of my table where DATE>today-7days.
But my datas in Oracle are 'dates' and in R are 'characters'.
now_7<-format(Sys.time()-(7*60*60*24), "%Y-%m-%d 00:00:00")
How to do?

View this message in context: http://r.789695.n4.nabble.com/Compare-date-Oracle-with-Sys-time-tp4635624.html
Sent from the R help mailing list archive at Nabble.com.

R-help at r-project.org mailing list
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