Hello, Try
x <- 20102010 as.Date(as.character(x), format="%Y%d%m") [1] "2010-10-20" as.POSIXct(as.character(x), format="%Y%d%m") [1] "2010-10-20 BST" Note that you must pass x as a character vector. If not, the date functions will see it as the number of days since an origin such as 1970-01-01 or others. See the help page for as.POSIXct for examples on this. ?as.POSIXct This is obviously not your case, so the examples above should solve it. For date formats see ?strptime Hope this helps, Rui Barradas -- View this message in context: http://r.789695.n4.nabble.com/Dates-in-R-tp4614266p4614751.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.