当前位置: 技术问答>java相关
怎们取得系统当前日期与星期
来源: 互联网 发布时间:2015-02-15
本文导语: 1、怎们取得系统当前日期与星期几 2、这句话错在哪里,怎么改 System.out.println(Calendar.get(Calendar.DAY_OF_MONTH)); | 当前日期 Calendar.getInstance().get(Calendar.DAY_OF_MONTH); 星期几 Calendar.getInstance().get(Calenda...
1、怎们取得系统当前日期与星期几
2、这句话错在哪里,怎么改
System.out.println(Calendar.get(Calendar.DAY_OF_MONTH));
2、这句话错在哪里,怎么改
System.out.println(Calendar.get(Calendar.DAY_OF_MONTH));
|
当前日期
Calendar.getInstance().get(Calendar.DAY_OF_MONTH);
星期几
Calendar.getInstance().get(Calendar.DAY_OF_WEEK);
Calendar.getInstance().get(Calendar.DAY_OF_MONTH);
星期几
Calendar.getInstance().get(Calendar.DAY_OF_WEEK);
|
看看
http://www.csdn.net/develop/article/11/11145.shtm
http://www.csdn.net/develop/article/11/11145.shtm
|
corejava.Day today = new corejava.Day();//获得当前系统日期
today.weekday()//可获得是星期几(如:corejava.Day.SUNDAY)
today.weekday()//可获得是星期几(如:corejava.Day.SUNDAY)
|
这样:
Calendar now = new GregorianCalendar();
System.out.println(now.get(Calendar.DAY_OF_MONTH));
Calendar now = new GregorianCalendar();
System.out.println(now.get(Calendar.DAY_OF_MONTH));