dates = as.Date(c('15-06-2023','25-06-2023'), format='%d-%m-%Y')

class(dates)
typeof(dates)

num_dates = as.numeric(dates)

class(num_dates)

dates[1:length(dates)]

# to format a date from user format to R format
as.Date('20-03-23', format='%d-%m-%y') #or
as.Date('20-03-2023', format='%d-%m-%Y')
example_date = as.Date('20JAN2040', format='%d%b%Y')

# to extract Day, motnh. year from a date
format(example_date,'%Y')

# extracting data from vector datatype date
month_from_dates = format(dates,"%d")
month_from_dates

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: