<p><div><div><div><div data-show-faces="false" data-height="21" data-width="100" data-layout="button_count" data-send="true" data-href="https://www.r-bloggers.com/parsing-dates-and-time-part-2-exercises/"></div></div><div></div></div><div></div></div>
<div>
(This article was first published on <strong><a href="https://www.r-exercises.com/2018/04/11/parsing-dates-and-time-part-2-exercises/"> R-exercises</a></strong>, and kindly contributed to <a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers)</a> </div>
<p>In the exercises below, we will continue working with lubridate and examine more features of the library.<br>
Answers to these exercises are available <a>here</a>.<br>
Please check the previous exercise <a rel="nofollow" href="https://www.r-exercises.com/2018/03/28/parsing-date-and-time-exercise-1/" target="_blank"> here</a>.<br>
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.</p>
<p><strong>Exercise 1</strong><br>
Here is a string, which looks like:<br>
<code> dt &lt;-  &quot;Apr, 11th 2018 17:00&quot; </code>.<br>
Convert it to R’s date-time format.</p>
<p><strong>Exercise 2</strong></p>
<p>Here is another representation of dt:<br>
<code> dt &lt;-  &quot;2018/04/11 17:00&quot; </code>.<br>
Convert it to R’s date-time format.</p>
<p><strong>Exercise 3</strong></p>
<p>Suppose dt is in this format:</p>
<p><code> dt &lt;-  &quot;11.4.2018 17&quot; </code><br>
Convert it to R’s date-time format.</p>
<p><strong>Exercise 4</strong></p>
<p>Lubridate allows you to parse dates and times in a convoluted format into R’s date-time format.<br>
<code> dt &lt;-  &quot;Wed apr 11th 2018 at 7pm&quot; </code></p>
<p>Parse it properly using the lubridate’s function.</p>
<p><strong>Exercise 5</strong></p>
<p>Suppose I have to parse the 110th day of 2018; how do I achieve that?</p>
<p><strong>Exercise 6</strong></p>
<p>Now, suppose you have two strings: “1 2018”, which represents the first quarter of 2018 and “3 2018”, which represents the 3rd quarter of 2018. Using lubridate’s functions, parse it properly.</p>
<p><strong>Exercise 7</strong></p>
<p>Suppose you have to parse the 10th week of 2018; please parse it with lubridate.</p>
<div>
<h3>Related exercise sets:</h3>
<ol>
<li><a rel="nofollow" href="https://www.r-exercises.com/2018/03/28/parsing-date-and-time-exercise-1/" title="Parsing Dates and Time – Part 1: Exercises" target="_blank">Parsing Dates and Time – Part 1: Exercises </a></li>
<li><a rel="nofollow" href="https://www.r-exercises.com/2016/08/15/dates-and-times-simple-and-easy-with-lubridate-part-1/" title="Dates and Times – Simple and Easy with lubridate exercises (part 1)" target="_blank">Dates and Times – Simple and Easy with lubridate exercises (part 1) </a></li>
<li><a rel="nofollow" href="https://www.r-exercises.com/2016/08/29/dates-and-times-simple-and-easy-with-lubridate-exercises-part-2/" title="Dates and Times – Simple and Easy with lubridate exercises (part 2)" target="_blank">Dates and Times – Simple and Easy with lubridate exercises (part 2) </a></li>
<li><a rel="nofollow" href="http://www.r-exercises.com/start-here-to-learn-r/" target="_blank">Explore all our (>1000) R exercises</a></li>
<li><a rel="nofollow" href="http://www.r-exercises.com/r-courses/" target="_blank">Find an R course using our R Course Finder</a> directory</li>
</ol>
</div>
	<p>
<div>
<div>To <strong>leave a comment</strong> for the author, please follow the link and comment on their blog: <strong><a href="https://www.r-exercises.com/2018/04/11/parsing-dates-and-time-part-2-exercises/"> R-exercises</a></strong>.</div>
<hr>
<a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers.com</a> offers <strong><a rel="nofollow" href="https://feedburner.google.com/fb/a/mailverify?uri=RBloggers">daily e-mail updates</a></strong> about <a rel="nofollow" href="https://www.r-project.org/" title="The R Project for Statistical Computing">R</a> news and <a rel="nofollow" href="https://www.r-bloggers.com/search/tutorial" title="R tutorials">tutorials</a> on topics such as: <a rel="nofollow" href="https://www.r-bloggers.com/search/data%20science" title="Data science">Data science</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/Big%20Data" title="Big Data">Big Data, <a rel="nofollow" href="https://www.r-users.com/" title="R jobs">R jobs</a>, visualization (<a rel="nofollow" href="https://www.r-bloggers.com/search/ggplot2" title="ggplot and ggplot2 tutorials">ggplot2</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/boxplot" title="Boxplots using lattice and ggplot2 tutorials">Boxplots</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/map" title="Maps and gis">maps</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/animation" title="Animation in R">animation</a>), programming (<a rel="nofollow" href="https://www.r-bloggers.com/search/RStudio" title="RStudio IDE for R">RStudio</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/sweave" title="Sweave and literate programming">Sweave</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/LaTeX" title="LaTeX in R">LaTeX</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/SQL" title="SQL and databases">SQL</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/eclipse" title="Eclipse IDE for R">Eclipse</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/git" title="git and github, Version Control System">git</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/hadoop" title="Large data in R using Hadoop">hadoop</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/Web+Scraping" title="Web Scraping of google, facebook, yahoo, twitter and more using R">Web Scraping</a>) statistics (<a rel="nofollow" href="https://www.r-bloggers.com/search/regression" title="Regressions and ANOVA analysis tutorials">regression</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/PCA" title="principal component analysis tutorial">PCA</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/time+series" title="Time series">time series</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/trading" title="finance trading">trading</a>) and more...
<img width="1" alt="" src="http://feeds.feedburner.com/~r/RBloggers/~4/rU4djpTMMzo" height="1"></a></div>