replaceDate | R Documentation |
Replace elements of a string with date and time elements.
replaceDate(string=NULL, date.str=NULL, format = "%Y-%m-%d %H:%M:%S")
string |
a string with the elements to replace with the date and time elements. For example, if the string "yyyy/yyyymmdd" is provided then yyyy will be replaced with the year, mm with the month and dd with the day. Legend: yyyy year; mm month; dd day; hh hour. |
date |
a date-time string, such as for example "2017.01.01" |
format |
the format to be used for the output string. For the
list of items see the help page of |
These functions invoke the function str2Rdate
and the
built-in functions formatC
, as.POSIXlt
, gsub
and strptime
.
str2Rdate: a string of the same lenght as the input string where the elements yyyy,mm,dd,hh have been replaced by the date-time elements.
Cristian Lussana
year
, month
, day
a <- replaceDate("yyyymm/hello_yyyymmdd.txt","2017.01.01.12","%Y.%m.%d.%H")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.