Here you will find daily news and tutorials about R, contributed by hundreds of bloggers.
There are many ways to follow us - By e-mail:On Facebook: If you are an R blogger yourself you are invited to add your own R content feed to this site (Non-English R bloggers should add themselves- here)

[This article was first published on R-exercises, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

In the exercises below, we will continue our work with the lubridate package to see more features of it.

If you obtained a different (correct) answer than those listed on the solutions page, please feel free to post your answer as a comment on that page.

Exercise 1
Lubridate offers two functions to see the date and date-time, at the moment, in the system. Use them to see the time in your time zone. Exercise 2

There is a base function named “difftime” to find time difference between two times. Now use this to find out the time difference in weeks between. x <- "11 th april 2012" y <- "April 24th 2018 11:59:59"

Exercise 3

Do the same as above and find the difference between the system time and x, in hours.

Exercise 4

Lets say we have: x <- "11 th april 2018 11.30.00"

We want to add one day to x. How do we achieve that?

Exercise 5

Now add 100 hours to x and find which date-time it is.

Work with different packages that help shape dates and times,

learn about the lubridate package for quick and easy dates and times,

and much more

Exercise 6

Now, how can we get the date-time of 3 weeks prior to x?

Exercise 7

Now, read about the duration and spans from lubridate’s vignette. Try getting the date-time 10 years prior to x first by subtracting with years and then by using 10 year duration’s. See if they are similar and try to reason it.