ÈÕÆÚÀà¼Ó¼õ¼°JavaÖÐÈÕÆÚÀà²Ù×÷Ëã·¨´óÈ«
1.¼ÆËãijһÔ·ݵÄ×î´óÌìÊý
1Calendar time=Calendar.getInstance();
2time.clear();
3time.set(Calendar.YEAR,year); //year Ϊ int
4time.set(Calendar.MONTH,i-1);//×¢Òâ,Calendar¶ÔÏóĬÈÏÒ»ÔÂΪ0
5int day=time.getActualMaximum(Calendar.DAY_OF_MONTH);//±¾Ô·ݵÄÌìÊý
×¢£ºÔÚʹÓÃset·½·¨Ö®Ç°£¬±ØÐëÏÈclearһϣ¬·ñÔòºÜ¶àÐÅÏ¢»á¼Ì³Ð×Ôϵͳµ±Ç°Ê±¼ä
2.CalendarºÍDateµÄת»¯
(1) Calendarת»¯ÎªDate
Calendar cal=Calendar.getInstance();
Date date=cal.getTime();
(2) Dateת»¯ÎªCalendar
Date date=new Date();
Calendar cal=Calendar.getInstance();
cal.setTime(date);
3.¸ñʽ»¯Êä³öÈÕÆÚʱ¼ä £¨Õâ¸öÓõıȽ϶ࣩ
ÆäÒ»
Date date=new Date();
SimpleDateFormat df=new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
String time=df.format(date);
System.out.println(time);//2008-10-27 08:52:32
Æä¶þ
Calendar c = Calendar.getInstance();
System.out.println(c.getTime());//Mon Oct 27 08:51:21 CST 2008
SimpleDateFormat simpleDateTimeFormat = new SimpleDateFormat(" yyyy-MM-dd HH:mm:ss ");
c = Calendar.getInstance(Locale.CHINESE);
System.out.println(simpleDateTimeFormat.format(c.getTime()));// 2008-10-27 08:51:21
4.¼ÆËãÒ»ÄêÖеĵڼ¸ÐÇÆÚ
(1)¼ÆËãijһÌìÊÇÒ»ÄêÖеĵڼ¸ÐÇÆÚ
Calendar cal=Calendar.getInstance();
cal.set(Calendar.YEAR, 2006);
cal.set(Calendar.MONTH, 8);
cal.set(Calendar.DAY_OF_MONTH, 3);
int weekno=cal.get(Calendar.WEEK_OF_YEAR);
(2)¼ÆËãÒ»ÄêÖеĵڼ¸ÐÇÆÚÊǼ¸ºÅ
SimpleDateFormat df=new SimpleDateFormat("yyyy-MM-dd");
Calendar cal=Calendar.getInstance();
cal.set(Calendar.YEAR, 2006);
cal.set(Calendar.WEEK_OF_YEAR, 1);
cal.set(Calendar.DAY_OF_WEEK, Calendar.MONDAY);
System.out.println(df.format(cal.getTime()));
Êä³ö:
2006-01-02
5.add()ºÍroll()µÄÓ÷¨(²»Ì«³£ÓÃ)
(1)add()·½·¨
SimpleDateFormat df=new SimpleDateFormat("yyyy-MM-dd");
Calendar cal=Calendar.getInstance();
cal.set(Calendar.YEAR, 2006);
cal.set(Calendar.MONTH, 8);
cal.set(Calendar.DAY_OF_MONTH, 3);
cal.add(Calendar.DATE, -4);
Date date=cal.getTime();
System.out.println(df.format(date));
cal.add(Ca
Ïà¹ØÎĵµ£º
ListµÄÓ÷¨
List°üÀ¨List½Ó¿ÚÒÔ¼°List½Ó¿ÚµÄËùÓÐʵÏÖÀà¡£ÒòΪList½Ó¿ÚʵÏÖÁËCollection½Ó¿Ú£¬ËùÒÔList½Ó¿ÚÓµÓÐCollection½Ó¿ÚÌṩµÄËùÓг£Ó÷½·¨£¬ÓÖÒòΪListÊÇÁбíÀàÐÍ£¬ËùÒÔList½Ó¿Ú»¹ÌṩÁËһЩÊʺÏÓÚ×ÔÉíµÄ³£Ó÷½·¨£¬Èç±í1Ëùʾ¡£
±í1 List½Ó¿Ú¶¨ÒåµÄ³£Ó÷½·¨¼°¹¦ÄÜ
´Ó±í1¿ÉÒÔ¿´³ö£¬List½Ó¿ÚÌṩµÄÊʺÏÓÚ×ÔÉíµÄ ......
×î½ü¹«Ë¾Åöµ½ÐèÒªÓÃͼ±íµÄÐÎʽÏÔʾһЩÊý¾Ý£¬ÎҾͿªÊ¼µ½ÍøÉϲéѯ£¬²éµ½ÁËjfreechartºÍamcharts,ÕâÁ½ÕßÎÒ¶¼ÊµÏÖ¹ýÁË£¬jfreechart×îºóÉú³ÉͼƬ£¬µ«ÊÇͼƬЧ¹û²»ÊÇÎÒÏëÒªµÄ£¬È»ºóÓÖÑо¿amcharts ËüµÄЧ¹ûȷʵºÜºÃ£¬¶øÇÒ¹Ù·½ÍøÕ¾ÉÏ»¹ÓкÃЩÀý×ӿɹ©ÏÂÔØ£¬ÍøÖ·ÊÇ:www.amcharts.com
£¨ÏëÒªÍê³ÉÒ»¸öamchartsͼÐÎÐèÒªswfobjects. ......
6.·ºÐÍ:
1¡¢·ºÐ͵ÄÀàÐͲÎÊýÖ»ÄÜÊÇÀàÀàÐÍ£¨°üÀ¨×Ô¶¨ÒåÀࣩ£¬²»ÄÜÊǼòµ¥ÀàÐÍ¡£
¡¡¡¡2¡¢Í¬Ò»ÖÖ·ºÐÍ¿ÉÒÔ¶ÔÓ¦¶à¸ö°æ±¾£¨ÒòΪ²ÎÊýÀàÐÍÊDz»È·¶¨µÄ£©£¬²»Í¬°æ±¾µÄ·ºÐÍÀàʵÀýÊDz»¼æÈݵġ£
¡¡¡¡3¡¢·ºÐ͵ÄÀàÐͲÎÊý¿ÉÒÔÓжà¸ö¡£
¡¡¡¡4¡¢·ºÐ͵IJÎÊýÀàÐÍ¿ÉÒÔʹÓÃextendsÓï¾ä£¬ÀýÈç<T extends superclass>¡£Ï°¹ßÉϳÉΪ“Óн ......
ʹÓÃDOM·½Ê½£¬Java½âÎöXML»ù±¾²½Öè:
Ê×ÏÈ£¬ÎÒÃÇÐèÒª½¨Á¢Ò»¸ö½âÎöÆ÷¹¤³§¡£
DocumentBuilderFactory dbf=DocumentBuilderFactory.newInstance();
È»ºó¿ÉÒÔÀûÓÃÕâ¸ö¹¤³§À´»ñµÃÒ»¸ö¾ßÌåµÄ½âÎö¶ÔÏó¡£
DocumentBuilder builder=dbf.newDocumentBuilder();
DocumentBuilderµÄParse()·½·¨½ÓÊÜÒ»¸öXMLÎĵµÃû×÷ΪÊäÈë²ÎÊý£¬·µ»ØÒ ......