我正在尝试实施Jfreechart API,我正面临问题:
这是我的代码
/**Adding data in this series**/
seriesOne.add(new Task("Project Progress Bar",
new SimpleTimePeriod(makeDate(25, Calendar.JUNE, 2013),
makeDate(30, Calendar.JUNE, 2013))));
/**adding second task**/
/**Adding data in this series**/
seriesTwo.add(new Task("Project Progress Bar",
new SimpleTimePeriod(makeDate(28, Calendar.JUNE, 2013),
makeDate(30, Calendar.JUNE, 2013))));
makeDate的方法
private static Date makeDate(final int day, final int month, final int year) {
final Calendar calendar = Calendar.getInstance();
calendar.set(year, month, day);
final Date result = calendar.getTime();
return result;
}
我需要传递d1="2011-03-06" d2="2011-05-06" d3="2011-05-06" d4="2011-05-06"
而不是约会日期我怎么能这样做
new SimpleTimePeriod(makeDate(d1),
makeDate(d2))));
非常感谢任何帮助,请
答案 0 :(得分:1)
//assuming dates are passed in as a string in the format "yyyy-MM-dd"
public Date makeDate(String date){
return new SimpleDateFormat("yyyy-MM-dd").parse(string);
}
答案 1 :(得分:0)
使用DateFormat来完成工作希望这有帮助??
Date d=DateFormat.getDateInstance(DateFormat.LONG).parse("June 13, 2013");