Ò׽ؽØÍ¼Èí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

java¼ÆËãʱ¼ä²î

java¼ÆËãʱ¼ä²î
ÎÄÕ·ÖÀà:Java±à³Ì
±ÈÈ磺ÏÖÔÚÊÇ2004-03-26 13£º31£º40
¹ýÈ¥ÊÇ£º2004-01-02 11£º30£º24
ÎÒÏÖÔÚÒª»ñµÃÁ½¸öÈÕÆÚ²î£¬²îµÄÐÎʽΪ£ºXXÌìXXСʱXX·ÖXXÃë
·½·¨Ò»£º
DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
try
{
Date d1 = df.parse("2004-03-26 13:31:40");
Date d2 = df.parse("2004-01-02 11:30:24");
long diff = d1.getTime() - d2.getTime();
long days = diff / (1000 * 60 * 60 * 24);
}
catch (Exception e)
{
}
·½·¨¶þ£º
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
java.util.Date now = df.parse("2004-03-26 13:31:40");
java.util.Date date=df.parse("2004-01-02 11:30:24");
long l=now.getTime()-date.getTime();
long day=l/(24*60*60*1000);
long hour=(l/(60*60*1000)-day*24);
long min=((l/(60*1000))-day*24*60-hour*60);
long s=(l/1000-day*24*60*60-hour*60*60-min*60);
System.out.println(""+day+"Ìì"+hour+"Сʱ"+min+"·Ö"+s+"Ãë");
·½·¨Èý£º
SimpleDateFormat dfs = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
java.util.Date begin=dfs.parse("2004-01-02 11:30:24");
java.util.Date end = dfs.parse("2004-03-26 13:31:40");
long between=(end.getTime()-begin.getTime())/1000;//³ýÒÔ1000ÊÇΪÁËת»»³ÉÃë
long day1=between/(24*3600);
long hour1=between%(24*3600)/3600;
long minute1=between%3600/60;
long second1=between%60/60;
System.out.println(""+day1+"Ìì"+hour1+"Сʱ"+minute1+"·Ö"+second1+"Ãë");
====================================================
java ±È½Ïʱ¼ä´óС
String s1="2008-01-25 09:12:09";
String s2="2008-01-29 09:12:11";
java.text.DateFormat df=new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
java.util.Calendar c1=java.util.Calendar.getInstance();
java.util.Calendar c2=java.util.Calendar.getInstance();
try
{
c1.setTime(df.parse(s1));
c2.setTime(df.parse(s2));
}catch(java.text.ParseException e){
System.err.println("¸ñʽ²»ÕýÈ·");
}
int result=c1.compareTo(c2);
if(result==0)
S


Ïà¹ØÎĵµ£º

javaÖеÄURLEncoderºÍURLDecoderÀà

javaÖеÄURLEncoderºÍURLDecoderÀà
    URLEncoderÀà°üº¬½«×Ö·û´®×ª»»Îªapplication/x-www-form-urlencoded MIME ¸ñʽµÄ¾²Ì¬·½·¨¡£
ΪÁ˽â¾öwebÉè¼ÆÖв»Í¬²Ù×÷ϵͳ¼äµÄ²îÒìÐÔ£¬ÎÒÃÇÔÚURLÖÐʹÓõÄ×Ö·û¾Í±ØÐëÊÇÒ»¸öASCII×Ö·û¼¯µÄ¹Ì¶¨×Ö¼¯ÖеÄÔªËØ£¬¾ßÌåÈçÏ£º
1.´óд×ÖĸA-Z
2.Сд×Öĸa- ......

javaµÄdoubleµÄ¾«¶ÈÎÊÌâ

ÔÚjavaÖУ¬Ê¹ÓÃdouble½øÐÐÔËË㣬ÓÐʱ»á³öÏÖ¾«¶È¶ªÊ§µÄÎÊÌ⣬ֵ»áÓÐÄÇô0.00000***1Æ«²îµÄÆ«²î£¬µ¼ÖÂÆ¥ÅäУÑé³£³£³öÏÖÎÊÌâ
½â¾ö·½°¸ÈçÏÂ:
  /** 
     * ¶ÔdoubleÊý¾Ý½øÐÐÈ¡¾«¶È. 
     * @param value  doubleÊý¾Ý. 
     * ......

Java£¬¼ÆËãÍøÂçµØÖ·

    ºÃ¼¸Ììûд²©¿Í£¬Õ⼸Ì춼æ×Åд´úÂ룬ÖÐÆÚ¼ì²é¸Õ¹ý£¬ºóÃæÊ£ÏµÄʱ¼äʵ¼ÊºÜÉÙÁË£¬Òª×¥½ôʱ¼äÁË£¬ÂíÉϾ͵ñÏÒµ×ßÈËÁË¡£ÑÔ¹éÕý´«£¬ÔÚ±àÂë¹ý³ÌÖÐÓöµ½µÄÎÊÌ⣬ÎÒ¶¼¼Ç¼ÔÚ²©¿ÍÖУ¬·½±ãÒÔºó²éÔÄдÂÛÎÄ¡£Õâ´ÎÊǼÆËãÍøÂçµØÖ·£¬¸ø³öÒ»¸öipºÍËüµÄ×ÓÍøÑÚÂ룬ͨ¹ýÔËËãµÃµ½ÍøÂçµØÖ·£¨»òÕß˵ÊÇÍøÂçºÅ£©
public static ......

JAVAÏß³ÌÖ®Î壺Ï̵߳Äͬ²½

      Èç¹û³ÌÐòÊǵ¥Ị̈߳¬Ö´ÐÐÆðÀ´²»±Øµ£ÐÄ´ËÏ̻߳ᱻÆäËûÏ̴߳òÈÅ£¬¾ÍÏñÔÚÏÖʵÖУ¬Í¬Ò»Ê±¼äÖ»Íê³ÉÒ»¼þÊÂÇ飬¿ÉÒÔ²»Óõ£ÐÄÕâ¼þÊÂÇé»á±»ÆäËûÊÂÇé´òÈÅ¡£µ«ÊÇÈç¹û³ÌÐòÖÐͬʱʹÓöàỊ̈߳¬¾ÍºÃ±ÈÏÖʵÖГÁ½¸öÈËͬʱ½øÈëÒ»ÉÈÃÅ”£¬´Ëʱ¾ÍÐèÒª¿ØÖÆ£¬·ñÔòÈÝÒ××èÈû¡£ÎªÁ˱ÜÃâ¶àÏ̹߳²Ïí×ÊÔ´·¢Éú³ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ