HI, 1.
date1<-c("5 jan 2013", "1 jan 2013") date1<-as.Date(date1,format="%d %b %Y") date1[1]-date1[2] #Time difference of 4 days 2. If you only have the week number of year without any other information, it would be difficult to predict which day that would be. You could get the week number from the date: library(lubridate) date2<-"2013-01-26" wday(ymd(date2),label=TRUE) # 1 parsed with %Y-%m-%d #[1] Sat week(ymd(date2)) # 1 parsed with %Y-%m-%d #[1] 4 A.K. ----- Original Message ----- From: yash kajaria <yash.kaja...@gmail.com> To: r-help@r-project.org Cc: Sent: Thursday, March 14, 2013 9:45 AM Subject: [R] date & time manipulation- R 2.15.1 windows 7 Hi, I wanted to learn how to solve a date and time manipulation where i can do the following two 1. difference of two dates eg (differnce between 5th jan 2013 and 1st jan 2013) 2.Suppose i have week number of the year, i want to know if i can find out the day it refers to eg( say week 2 of 2013 would be 6th jan 2013 and the day is sunday) i need my result to tell me that its the 6th of jan 2013 as well as the day (sunday) Can u please help me out? Thanks, Yashvardhan Kajaria [[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. ______________________________________________ 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.