ÈçºÎÀûÓÃjavaµÃµ½µ±Ç°µÄʱ¼äºÍÇ°Ò»ÌìµÄʱ¼ä
1.µÃµ½µ±Ç°µÄʱ¼ä
Calendar cal = Calendar.getInstance();
String time=formatter.format(cal.getTime());
String strEnd=time.substring(0, 16);// 2007-10-30 09:30
2.µÃµ½Ç°Ò»ÌìµÄʱ¼ä
Calendar c = Calendar.getInstance();
c.add(Calendar.DAY_OF_MONTH, -1);
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String mDateTime=formatter.format(c.getTime());
String strStart=mDateTime.substring(0, 16);//2007-10-29 09:30
3.µÃµ½Ç°¼¸ÌìµÄʱ¼ä
Calendar c = Calendar.getInstance();
c.add(Calendar.DAY_OF_MONTH, -5);//µÃµ½Ç°5
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String mDateTime=formatter.format(c.getTime());
String strStart=mDateTime.substring(0, 16);//2007-10-24 09:30
4.µÃµ½µ±Ç°Ê±¼äµÄÇ°¼¸ÄêµÄʱ¼ä
Calendar c = Calendar.getInstance();
c.add(Calendar.YEAR, -5);//µÃµ½Ç°5Äê
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String mDateTime=formatter.format(c.getTime());
String strStart=mDateTime.substring(0, 16);//2002-10-24 09:30
²¹³ä£ºÎÒÒªÓõÄÊÇÇ°Ò»ÌìÁãµãµÄʱ¼ä£¬ËùÒÔÕâÑùд£º
Calendar c = Calendar.getInstance();
c.add(Calendar.DAY_OF_MONTH, -1);
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd 00:00:00");
String theDayBeforeToday = formatter.format(c.getTime());
Ïà¹ØÎĵµ£º
package ch01;
public class BubbleSort
{
public static void main(String[] args){
int[] values ={
&n ......
Java¹æÔòÒýÇ湤×÷ÔÀí¼°ÆäÓ¦ÓÃ
¡¡¡¡Õª Òª Java¹æÔòÒýÇæÊÇÒ»ÖÖǶÈëÔÚJava³ÌÐòÖеÄ×é¼þ£¬ËüµÄÈÎÎñÊǰѵ±Ç°Ìá½»¸øÒýÇæµÄJavaÊý¾Ý¶ÔÏóÓë¼ÓÔØÔÚÒýÇæÖеÄÒµÎñ¹æÔò½øÐвâÊԺͱȶԣ¬¼¤»îÄÇЩ·ûºÏµ±Ç°Êý¾Ý״̬ϵÄÒµÎñ¹æÔò£¬¸ù¾ÝÒµÎñ¹æÔòÖÐÉùÃ÷µÄÖ´ÐÐÂß¼£¬´¥·¢Ó¦ÓóÌÐòÖжÔÓ¦µÄ²Ù×÷¡£
¡¡¡¡ÒýÑÔ
¡¡¡¡Ä¿Ç°£¬JavaÉçÇøÍƶ¯²¢·¢Õ¹Á ......
from: http://www.leftworld.net/online/java/index.html
<Thinking in java>¸½Â¼C Java±à³Ì¹æÔò
±¾¸½Â¼°üº¬ÁË´óÁ¿ÓÐÓõĽ¨Ò飬°ïÖú´ó¼Ò½øÐеͼ¶³ÌÐòÉè¼Æ£¬²¢ÌṩÁË´úÂë±àдµÄÒ»°ãÐÔÖ¸µ¼£º
(1) ÀàÃûÊ××ÖĸӦ¸Ã´óд¡£×ֶΡ¢·½·¨ÒÔ¼°¶ÔÏ󣨾ä±ú£©µÄÊ××ÖĸӦСд¡£¶ÔÓÚËùÓбêʶ·û£¬ÆäÖаüº¬µÄËùÓе¥´Ê¶¼Ó¦½ô¿¿ÔÚÒ»Æð£ ......
1¡¢ ¶ÔÏóµÄ³õʼ»¯
(1) ·Ç¾²Ì¬¶ÔÏóµÄ³õʼ»¯
ÔÚ´´½¨¶ÔÏóʱ£¬¶ÔÏóËùÔÚÀàµÄËùÓÐÊý¾Ý³ÉÔ±»áÊ×ÏȽøÐгõʼ»¯¡£
»ù±¾ÀàÐÍ£ºintÐÍ£¬³õʼ»¯Îª0¡£
Èç¹ûΪ¶ÔÏó£ºÕâЩ¶ÔÏó»á°´Ë³Ðò³õʼ»¯¡£
¡ùÔÚËùÓÐÀà³ÉÔ±³õʼ»¯Íê³ÉÖ®ºó£¬²Åµ÷Óñ¾ÀàµÄ¹¹Ôì·½·¨´´½¨¶ÔÏó¡£
¹¹Ôì·½·¨µ ......
¹Ø¼ü×Ö: javaÅÅÐòËã·¨
Java¸÷ÖÖÅÅÐòËã·¨
1£©·ÖÀࣺ
1£©²åÈëÅÅÐò£¨Ö±½Ó²åÈëÅÅÐò¡¢Ï£¶ûÅÅÐò£©
2£©½»»»ÅÅÐò£¨Ã°ÅÝÅÅÐò¡¢¿ìËÙÅÅÐò£©
3£©Ñ¡ÔñÅÅÐò£¨Ö±½ÓÑ¡ÔñÅÅÐò¡¢¶ÑÅÅÐò£©
4£©¹é²¢ÅÅÐò
5£©·ÖÅäÅÅÐò£¨ÏäÅÅÐò¡¢»ùÊýÅÅÐò£©
ËùÐ踨Öú¿Õ¼ä×î¶à£º¹é²¢ÅÅÐò
ËùÐ踨Öú¿Õ¼ä×îÉÙ£º¶ÑÅÅÐò
ƽ¾ùËÙ¶È×î¿ì£º¿ìËÙÅÅÐò ......