I think you are using the wrong function. See ?strftime Try dataset=c("1/2/1978") strptime(dataset,"%d/%m/%Y")
John Kane Kingston ON Canada > -----Original Message----- > From: rrast...@gmail.com > Sent: Fri, 3 Feb 2012 14:34:09 +0100 > To: r-help@r-project.org > Subject: [R] strftime - Dates from Excel files > > Hi > > I have many excel files were the Date field was not declared as date, > so the dates look like this: 1/2/1978 > I know that the format is day/month/year > > How can I make R change this to Date format? > > If I use strftime, I get wrong dates: > > dataset=c("1/2/1978") > > strftime(dataset,"%d/%m/%Y") > "19/02/0001" > > > Thanks in advance. > > ______________________________________________ > 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. ____________________________________________________________ Send any screenshot to your friends in seconds... Works in all emails, instant messengers, blogs, forums and social networks. TRY IM TOOLPACK at http://www.imtoolpack.com/default.aspx?rc=if2 for FREE ______________________________________________ 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.