我正在使用 SimpleDateFormat 来显示这样的日历:
public String getDate()
{
String DATE_FORMAT = "EEEE, dd/MM/yyyy HH:mm:ss";
SimpleDateFormat sdf = new SimpleDateFormat(DATE_FORMAT);
System.err.println(date.getTime().getMonth());
return sdf.format(date.getTime());
}
shell 返回 6
并显示:mardi, 06/07/2010 12:44:52
不可能吗?为什么?
谢谢
最佳答案
来自 Java API :
public int getMonth()
Returns a number representing the month that contains or begins with the instant in time represented by this Date object. The value returned is between 0 and 11, with the value 0 representing January.
关于java - 为什么使用 Java SimpleDateFormat 会减少一个月?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2992381/