Navjot Bajwa
Navjot Bajwa

Reputation: 11

Is there a way to store a variable as numeric in R but show as a date9 format?

as<-as.Date(today())

as_numeric<-as.numeric(as) 

shows 18505 but unable to create a date9. format for it

Upvotes: 1

Views: 73

Answers (1)

ThomasIsCoding
ThomasIsCoding

Reputation: 101335

Try toupper + format + as.Date like below

> toupper(format(as.Date(as_numeric,origin = "1970-01-01"),format = "%d%b%Y"))
[1] "03SEP2020"

Upvotes: 1

Related Questions