首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Calendar.DATE和Calendar.DAY_OF_MONTH有什么区别?

Calendar.DATE和Calendar.DAY_OF_MONTH有什么区别?
EN

Stack Overflow用户
提问于 2018-08-29 02:57:03
回答 1查看 2.9K关注 0票数 1

我打电话的时候有什么不同吗?

代码语言:javascript
复制
calendar.get(Calendar.DATE);
calendar.get(Calendar.DAY_OF_MONTH);
calendar.set(Calendar.DATE, day);
calendar.set(Calendar.DAY_OF_MONTH, day);
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2018-08-29 03:09:55

请参阅java.util.Calendar的api文档(重点是我的):

公共静态最终int DAY_OF_MONTH get字段号,并设置该字段号,指示月份的日期。这是日期的同义词。月的第一天有值1。

同义词”指的是同义的词。这两个常数的意思是相同的,是可互换的。

此外,如果您查看代码,您将注意到这些常量是用相同的值定义的:

代码语言:javascript
复制
/**
 * 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;
票数 11
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/52068844

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档