getDate | R Documentation |
Extract all dates from a string
getDate(str1, out.format = "%Y-%m-%d")
str1 |
string to parse |
out.format |
date output format |
DATE FORMATS IN R
Date Specification | Description | Example | ||
%a | Abbreviated weekday | Sun, Thu | ||
%A | Full weekday | Sunday | ||
%b | Abbreviated month | May, Jul | ||
%B | Full month | March, July | ||
%d | Day of the month | 27, 07 | ||
%j | Day of the year | 148, 188 | ||
%m | Month | 05, 07 | ||
%U | Week, with Sunday as first day | 22, 27 | ||
%w | Weekday, Sunday is 0 | 0, 4 | ||
%W | Week, with Monday as first day | 21, 27 | ||
%x | Date, locale-specific | |||
%y | Year without century | 84, 05 | ||
%Y | Year with century | 1984, 2005 | ||
%C | Century | 19, 20 | ||
%D | Date formatted %m/%d/%y | 07/17/23 | ||
%u | Weekday, Monday is 1 | 7, 4 | ||
str1 <- "The video was recorded on July 19, 2023."
str2 <- "The video was recorded over a 4 hour period
starting on July 19, 2023."
str3 <- "The first batch aug 12,2024 of aug 12,
2024 reports are due on July 12, 2024; the second
batch on 7/19/24."
str4 <- c("On 3.12.25, Jerry is taking one month
05.13.1895 of leave and is not scheduled to
return until around 4-9-2025.", "The staff
will be out on training on 10/11/24,
Oct 12, 2024, and 10-13-24.")
getDate(str1)
getDate(str2, out.format = "%Y-%m-%d")
getDate(str3, out.format = "%m-%d/%Y")
getDate(str4)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.