Hello, On further thinking about the issue, I guess this may be close to what you are looking for:
date1<-c("2012-06-12","2012-06-13","2012-06-14","2012-06-27","2012-07-01","2012-07-02","2012-07-03","2012-07-04") class(date1) [1] "character" #converting to date class date2<-as.Date(date1,format="%Y-%m-%d") class(date2) [1] "Date" date3<-as.data.frame(date2) colnames(date3)<-"date" difft<- difftime(Sys.time(),date3[,1])>=7 date3[difft,] [1] "2012-06-12" "2012-06-13" "2012-06-14" "2012-06-27" > class(date3[difft,] ) [1] "Date" A.K. ----- Original Message ----- From: cindy.dol <cindy.dolom...@insa-lyon.fr> To: r-help@r-project.org Cc: 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@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. ______________________________________________ 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.