R: convert month and day to one month in POSIXct

Looking at the time format specifiers, I do not see any parameters for dates like 2/5/2010 (month / day / year, one digit, without spaces). Are there any built-in methods for converting dates in this format?

+4
source share
2 answers

as.POSIXct('2/5/2010',format='%m/%d/%Y')

see ?strptime for formatting options.

+6
source

In R use

strptime ('2/5/2010', "% m /% d /% Y")

The strptime documentation is misleading.

% m and% d can handle both single-digit month R and double dig

+2
source

Source: https://habr.com/ru/post/1394467/


All Articles