Calendar.MONTH
Calendar now=Calendar.getInstance();
System.out.print(now.get(Calendar.MONTH));
得到的月份少1,其他年,日,甚至是秒,都是正常的
它返回的是常量值,从0到11
最好是用常量值,Calendar.JANUARY,Calendar.FEBUARY,Calendar.MARCH......
API文档中,MONTH字段的详细信息.MONTH
public static final int MONTH指示月份的 get 和 set 的字段数字。这是一个特定于日历的值。一年中的第一个月是 JANUARY,它为 0;最后一个月取决于一年中的月份数。
MonthCalendar是VS.NET里面的一个月历控件,虽然现在有很多别人写的月历控件,但这个控件对付不少应用还是足够了。由于最近一直在写记帐软件,其中就得用它选日期,所以对它大致了解了一些。
在这个控件中点每个元素(日期、标题、星期、链接等等)都会触发一个点击事件,而.NET中并没有给每种点击都安排一个事件(只有一个DateSelected事件),因此需要用户自己过滤。
可以用这样编写这个事件处理函数(这个函数只处理选中日期的情况):


















MonthCalendar.HitArea枚举类型还有很多别的值,对应月历中点的类型,这个参看MSDN。
java中calendar的用法


// 将 Date 对象反应到一个 Calendar 对象中, // 先获得一个实例,然后设置 Date 对象
calendar.setTime(date);
月份的起始值为0而不是1,所以要设置八月时,我们用7而不是8。
calendar.set(Calendar.
计算2000-01-01是星期几
calendar.get(calendar.DAY_OF_WEEK )