1,java类分解:
import java.util.Calendar; import java.util.Date; public class Test01 { @SuppressWarnings("deprecation") public static void main(String[] args) { Date d = new Date(); Calendar c = Calendar.getInstance(); c.setTime(d); int year = c.get(Calendar.YEAR); int month=c.get(Calendar.MONTH)+1; int day =c.get(Calendar.DAY_OF_MONTH); int hour =c.get(Calendar.HOUR_OF_DAY); int minute =c.get(Calendar.MINUTE); int second =c.get(Calendar.SECOND); System.out.println("=====年:"+year); System.out.println("=====月:"+month); System.out.println("=====日:"+day); System.out.println("=====时:"+hour); System.out.println("=====分:"+minute); System.out.println("=====秒:"+second); Date mydate=new Date(); int myweekday=mydate.getDay(); String weekday = ""; if(myweekday == 0){ weekday=" 星期日"; } else if(myweekday == 1){ weekday=" 星期一"; } else if(myweekday == 2){ weekday=" 星期二"; } else if(myweekday == 3){ weekday=" 星期三"; } else if(myweekday == 4){ weekday=" 星期四"; } else if(myweekday == 5){ weekday=" 星期五"; } else if(myweekday == 6){ weekday=" 星期六"; } System.out.println("今天是:"+weekday); } }
2,查询语句分解:...
原文:http://www.cnblogs.com/bykj/p/4805783.html