SimpleDateFormat does not process DD properly
date, java, simpledateformat
Solution
Capital "D" is day of year; lowercase "d" is day of month (`SimpleDateFormat` javadocs). Try:
SimpleDateFormat ft = new SimpleDateFormat ("yyyy_MM_dd_HH_mm");
Also, capital "Y" is "week year"; usually lowercase "y" ("year") is used.
Problem
I am trying to get a format like this: ``` 2013-06-15-17-45 ``` I do the following in my code: ``` Date d = new Date(); SimpleDateFormat ft = new SimpleDateFormat ("YYYY_MM_DD_HH_mm"); String fileName = "D:\\"+ft.format(d)+".csv"; ``` But I don't get the DD right. It creates a file with a name like this: ``` D:\\2013_12_340_13_53.csv ```