I'm still not entirely sure I follow the desired usage, as the original post made no reference to ggplot2, but as Gabor mentioned the yearmon etc stuff is quite useful.
If you are formatting arbitrary precision dates, take a look at axTicksByTime in xts. Both xts and quantmod use it for plotting. The core calculation is from ?endpoints I think the effect is what you desire --- though the logic of the function may be more than you want/need. I use it within the package(s) to make intelligent breaks given the periodicity of the data. Some examples are at: http://www.quantmod.com http://www.quantmod.com My presentation slides from July's Rmetrics conference in Switzerland are posted here: http://www.quantmod.com/Rmetrics2008/ http://www.quantmod.com/Rmetrics2008/ Most of the functions you have written are somewhere within xts already. At least the functionality is. See the vignette: http://cran.r-project.org/web/packages/xts/index.html http://cran.r-project.org/web/packages/xts/index.html Jeff -- View this message in context: http://www.nabble.com/Truncating-dates-%28and-other-date-time-manipulations%29-tp19436962p19458228.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.