Check out example codes for "diff days R lubridate". It will help you in understanding the concepts better.

Code Example 1

library(lubridate)
difftime(ymd("2018-12-31"), ymd('2010-01-01'), "days")

Learn ReactJs, React Native from akashmittal.com