Hi Jeremie,
Try:

as.Date("20-12-2020","%y-%m-%d")
[1] "2020-12-20"

Jim

On Thu, Jul 1, 2021 at 6:16 PM Jeremie Juste <jeremieju...@gmail.com> wrote:
>
> Hello,
>
> I have been surprised when converting a character string to a date with the 
> following
> format,
>
> in R 4.1.0 (linux debian 10)
>
> as.Date("20-12-2020","%Y-%m-%d")
> [1] "20-12-20"
>
> in R 4.0.5 (window 10)
>
> as.Date("20-12-2020","%Y-%m-%d")
> [1] "0020-12-20"
>
>
> Here I was expecting a blunt and sharp NA, am I missing something?
>
> Best regards,
> Jeremie
>
> ______________________________________________
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to