Hi,

If the dates are the same format and the same length you can try this :

dates<-c("1/1/2009","2/1/2009","3/1/2009")

dates_new<-as.Date(paste(substr(dates,1,3),substr(dates,7,8),sep="/"),format="%d/%m/%y"),
 
you can change the format to "%m/%d/%y"

Regards
M


Le 16/11/11 15:12, arunkumar1111 a écrit :
> Hi
>
> I have a data frame and i need to change the date format in it.
> my dataframe
>
> X Date
> 1 1/1/2009
> 2 2/1/2009
> 3 3/1/2009
>
> I need to change it to 2009-01-01
>
>
> --
> View this message in context: 
> http://r.789695.n4.nabble.com/changing-date-format-in-a-dataframe-tp4076411p4076411.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> 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.
>


-- 
####################################
Mohamed Lajnef,IE INSERM U955 eq 15#
P?le de Psychiatrie                #    
H?pital CHENEVIER                  #
40, rue Mesly                      #
94010 CRETEIL Cedex FRANCE         #
mohamed.laj...@inserm.fr           #
tel : 01 49 81 32 79               #
Sec : 01 49 81 32 90               #
fax : 01 49 81 30 99               #
####################################



        [[alternative HTML version deleted]]

______________________________________________
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.

Reply via email to