我打电话的时候有什么不同吗?
calendar.get(Calendar.DATE);
calendar.get(Calendar.DAY_OF_MONTH);
calendar.set(Calendar.DATE, day);
calendar.set(Calendar.DAY_OF_MONTH, day);发布于 2018-08-29 03:09:55
请参阅java.util.Calendar的api文档(重点是我的):
公共静态最终int DAY_OF_MONTH get字段号,并设置该字段号,指示月份的日期。这是日期的同义词。月的第一天有值1。
“同义词”指的是同义的词。这两个常数的意思是相同的,是可互换的。
此外,如果您查看代码,您将注意到这些常量是用相同的值定义的:
/**
* Field number for <code>get</code> and <code>set</code> indicating the
* day of the month. This is a synonym for <code>DAY_OF_MONTH</code>.
* The first day of the month has value 1.
*
* @see #DAY_OF_MONTH
*/
public final static int DATE = 5;
/**
* Field number for <code>get</code> and <code>set</code> indicating the
* day of the month. This is a synonym for <code>DATE</code>.
* The first day of the month has value 1.
*
* @see #DATE
*/
public final static int DAY_OF_MONTH = 5;https://stackoverflow.com/questions/52068844
复制相似问题