Convert string to date, format: "dd.mm.yyyy"

Solution 1:

The format is case-sensitive ("%y" is ambiguous and system dependent, I believe):

as.Date(D, "%d.%m.%Y")
[1] "1948-12-06"

The help topic ?strptime has details:

 ‘%y’ Year without century (00-99).  On input, values 00 to 68 are
      prefixed by 20 and 69 to 99 by 19 - that is the behaviour
      specified by the 2004 and 2008 POSIX standards, but they do
      also say ‘it is expected that in a future version the default
      century inferred from a 2-digit year will change’.

Solution 2:

To avoid remembering formats of the date we can use packaged solutions.

1) With lubridate

lubridate::dmy(D)
#[1] "1948-12-06"

2) Using anytime

anytime::anydate(D)
#[1] "1948-06-12"