convert date format

i have numeric dates after read_xlsx file as below

[1] "35078" "32653" "33226" "34261" "30800" "27591" "32440" "31597" "30979" "28484"

i want to convert it to format "31-12-2019" , i have tried below options but doesn't work

df$Hire_date <- as.Date(df$Hire_date,format = "%d%b%Y")
as.Date(x, "%d%b%Y")

DOB <-format(DOB,"ymd","%Y-%m-%d")
Hire_date <- format(DOB,"ymd","%Y-%m-%d")

I think the dates came in with their numeric value converted to a character value. This is how I would convert them.

DateValue <- as.Date(as.numeric("35078"), origin = "1899-12-30")
 format(DateValue, "%d-%m-%Y")
[1] "14-01-1996"
1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.