If you don't have to be finicky about leading zeros, the easy way is: as.character(asd,format="%d/%m/%Y")
?strptime If you are going to be finicky, then asdlt <- as.POSIXlt(asd) with(asdlt,sprintf("%d/%d/%d",mday,mon+1,year+1900)) ?as.POSIXlt ?sprintf --------------------------------------------------------------------------- Jeff Newmiller The ..... ..... Go Live... DCN:<jdnew...@dcn.davis.ca.us> Basics: ##.#. ##.#. Live Go... Live: OO#.. Dead: OO#.. Playing Research Engineer (Solar/Batteries O.O#. #.O#. with /Software/Embedded Controllers) .OO#. .OO#. rocks...1k --------------------------------------------------------------------------- Sent from my phone. Please excuse my brevity. Ron Michael <ron_michae...@yahoo.com> wrote: >Hi, > >Let say I have a date variable: > >> asd <- as.Date("2012-01-03") >> asd >[1] "2012-01-03" > > > >Now, I want to express this date like 3/1/2012. > >can somebody help me how to achieve that? > >Thanks, > >______________________________________________ >R-help@r-project.org mailing list >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 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.