How do I convert the y%m%d%H
format into \"%Y%m%d %H:%M:%S\"
. My dates run from 1970 to 2010.
Try this:
R> Sys.Date()
[1] "2012-07-23"
R> format(Sys.Date())
[1] "2012-07-23"
R> format(Sys.Date(), "%Y-%m-%d %H:%M:%S")
[1] "2012-07-23 00:00:00"
R>
as you probably have a Date
type which, by definition, has no hour/minute/second information--use POSIXct
for that. See help(DateTimeClasses)
the details, and a bazillion posts here and on the various mailing lists with working examples.