Manipulating dates and times is usually quite hard and confusing. When time zones come in, it gets even harder; but still, sometime one needs to process date-time objects in their code.
Lubridate is one of a few great packages which makes things a bit easier.
Answers to the exercises are available here.
Please, do all exercises using the
tidiverse packages. 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.
Parse ’01-31-2018′ as date.
Check if the year of the date is a leap year.
Check what day of the week (a full name) the date is.
Set the day of the week to Friday. What date is it now?
Parse ‘2018-01-01 1:0:0’ as a date-time with Chicago time.
Print the time with London time.
Create an interval starting at the date from exercise 1 and ending at the date from exercise 5.
Check the duration of the interval.
Check if the date ‘20180104’ is within the interval.
Why is the result of exercise 9
FALSE? How can you fix it?