标签:rda lin else format ext for 获取 settime parse
Scanner scanner=new Scanner(System.in); //创建输入对象 Calendar c= new GregorianCalendar();
c.setTime(d);
int day=c.get(Calendar.DAY_OF_MONTH);
c.set(Calendar.DAY_OF_MONTH,1);
System.out.println("日\t一\t二\t三\t四\t五\t六");
for(int i=0;i<c.get(Calendar.DAY_OF_WEEK)-1;i++)
{
System.out.print("\t");
}
int max=c.getActualMaximum(Calendar.DATE);
for(int i=1;i<=c.getActualMaximum(Calendar.DATE);i++)
{
if(i==day)
{
System.out.print(i+"*\t"); //在给定日期前加*
}
else
{
System.out.print(c.get(Calendar.DAY_OF_MONTH)+"\t");
}
if(c.get(Calendar.DAY_OF_WEEK)==Calendar.SATURDAY)
{
System.out.println();
}
c.add(Calendar.DAY_OF_MONTH, 1);
}
java Date类和DateFormt类和Calendar类写可视化日历 版本二,键盘实现输入
标签:rda lin else format ext for 获取 settime parse
原文地址:https://blog.51cto.com/14437184/2417909