- package One;
- import java.util.Calendar;
- public class DateGetInstance {
- public static void main(String[] args) {
- // TODO Auto-generated method stub
- //
- Calendar c=Calendar.getInstance();
- //sop(c);
- //sop(c.get(Calendar.YEAR)+"年"+c.get((Calendar.MONTH))+"月"+c.get(Calendar.DAY_OF_MONTH)+"日");
- //使用查表方法 返回月份
- String[] month={"一月","二月","三月","四月","五月","六月","七月",
- "八月","九月","十月","十一月","十二月",};
- //int index=c.get(Calendar.MONTH);
- //sop(month[index]);
- sop(c.get(Calendar.MONTH+1));
- }
- public static void sop(Object obj)
- {
- System.out.println(obj);
-
- }
- }
复制代码 |
|