/*String s = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";//生成随机验证码
for(int i=1;i<5;i++)
{
int row =(int)(Math.random()*1000 % s.length());
String a = s.substring(row,row+1);
System.out.print(a);
}*/
/*String a = "<student>学生</student><sex>女</sex><class>一班</class><name>张三</name>";//字符串的拆分
System.out.println("学生:"+a.substring(a.indexOf("<student>")+9, a.lastIndexOf("</student>")));
System.out.println("班级:"+a.substring(a.indexOf("<class>")+7, a.lastIndexOf("</class>")));
System.out.println("性别:"+a.substring(a.indexOf("<sex>")+5, a.lastIndexOf("</sex>")));
System.out.println("名字:"+a.substring(a.indexOf("<name>")+6, a.lastIndexOf("</name>")));
*/
Calendar a =Calendar.getInstance();//日期格式的设置
int year = 2016;
int month = 0;
int day = 21;
a.set(year,month,day);
SimpleDateFormat b = new SimpleDateFormat("yyyy年MM月dd日");
System.out.print(b.format(a.getTime()));

posted on 2016-12-23 16:42  二蒙  阅读(191)  评论(0编辑  收藏  举报