I am trying to get the current date and format it however i am getting an invalid month of 59. Under is the code
Code
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
DateFormat df = new SimpleDateFormat("yyyy-mm-dd");
Date todayDate = new Date();
String formatDate = df.format(todayDate);
Output is 2013-59-07
You need "MM"
for month. "mm"
is for minutes.
See http://docs.oracle.com/javase/6/docs/api/java/text/SimpleDateFormat.html