How to calculate number of days between 2 dates in R

r

#1

Hi,i am trying to take the difference in terms of number of days between 2 dates in R.The date format is-

DATE1= 05-FEB-2013,DATE2 = 20-JUNE-2004.
DATE1-DATE2 should give me the result 3152


#2

Try this:

as.Date(DATE1,"%d-%B-%Y") - as.Date(DATE2,"%d-%B-%Y")

Hope this helps.