java¼ÆËãÁ½ÈÕÆÚ¼ä¸ôÌìÊý
package com.color.program;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
public class CompareTime {
public static void main(String[] args){
String t1 = "2008-05-09";
String t2 = "2008-5-13";
try {
System.out.println(CompareTime.getBetweenDays(t1, t2));
} catch (ParseException e) {
e.printStackTrace();
}
}
/**
* È¡µÃÁ½¸öʱ¼ä¶ÎµÄʱ¼ä¼ä¸ô
* return t2 Óët1µÄ¼ä¸ôÌìÊý
* throws ParseException Èç¹ûÊäÈëµÄÈÕÆÚ¸ñʽ²»ÊÇ0000-00-00 ¸ñʽÅ׳öÒì³£
*/
public static int getBetweenDays(String t1,String t2) throws ParseException{
DateFormat format = new SimpleDateFormat("yyyy-MM-dd");
int betweenDays = 0;
Date d1 = format.parse(t1);
Date d2 = format.parse(t2);
Calendar c1 = Calendar.getInstance();
Calendar c2 = Calendar.getInstance();
c1.setTime(d1);
c2.setTime(d2);
// ±£Ö¤µÚ¶þ¸öʱ¼äÒ»¶¨´óÓÚµÚÒ»¸öʱ¼ä
if(c1.after(c2)){
c1 = c2;
c2.setTime(d1);
}
int betweenYears = c2.get(Calendar.YEAR)-c1.get(Calendar.YEAR);
betweenDays = c2.get(Calendar.DAY_OF_YEAR)-c1.get(Calendar.DAY_OF_YEAR);
for(int i=0;i<betweenYears;i++){
c1.set(Calendar.YEAR,(c1.get(Calendar.YEAR)+1));
betweenDays += c1.getMaximum(Calendar.DAY_OF_YEAR);
}
return betweenDays;
}
}
Ïà¹ØÎĵµ£º
http://www.cnblogs.com/rookieport/archive/2005/09/05/163393.html
ÁôÏÂÔ´´×÷ÕßµÄÁ´½Ó 10¸öÀý×Ó
ÁíÍ⻹ÓÐһƪ
//ÀûÓà java.awt.Robot ÀàÀ´×Ô¶¯Íê³ÉһЩ¼üÅÌ»òÊó±êµÄ¶¯×÷,ÏÂÃæÊÇÒ»¸öСÀý×Ó
//³ÌÐòÁ÷³Ì:Ä£ÄâÊó±ê×ó¼üµã»÷ ¿ªÊ¼-->ÔËÐÐ-->CMD-->DIR-->CLS-->EXIT
//Ä£ÄâÓÒ¼üµã»÷ ÒÆ¶¯µ½ÓÒϽÇ--&g ......
½ñÌìÔÚ±àдһ¸ö¿ìËÙÅÅÐòº¯Êý£¬ÆäÖÐÏëÓÃÒ»¸öÔÚC++ÖÐÀàËÆswap¹¦Äܵĺ¯Êý£¬½á¹ûÒý·¢ÁËһϵÁеÄÎÊÌâ¡£
ÏÂÃæÊÇÔÚÍøÉÏËѵ½µÄ´úÂ룬²¢ÔÚÎҵı¾µØ»úÉÏ×÷ÁËÔËÐС£
public class ParamTest
{
public static void ......
Òý£ºAndroid µÄAPIÖÐÓиö java.util.regex °ü£¬ÆäÖÐÓÐÁ½¸öÀ࣬һ¸ö½Ó¿ÚºÍÒ»¸öÒì³££º
Interfaces
MatchResult
Holds the results of a successful match of a Pattern against a given string.
Classes
Matcher
Provides a means of matching regular expressions against a given input,
finding occurrences of ......
¼òµ¥µÄ˵£¬ÄÚ²¿£¨inner£©ÀàÖ¸ÄÇЩÀඨÒå´úÂë±»ÖÃÓÚÆäËüÀඨÒåÖеÄÀࣻ¶ø¶ÔÓÚÒ»°ãµÄ¡¢ÀඨÒå´úÂ벻ǶÌ×ÔÚÆäËüÀඨÒåÖеÄÀ࣬³ÆÎª¶¥²ã£¨top-level£©Àà¡£¶ÔÓÚÒ»¸öÄÚ²¿À࣬°üº¬Æä¶¨Òå´úÂëµÄÀà³ÆÎªËüµÄÍⲿ£¨outer£©Àà¡£
1 Static member class£¨¾²Ì¬³ÉÔ±Àࣩ
ÀàÉùÃ÷Öаüº¬“static”¹Ø¼ü×ÖµÄÄÚ²¿Àà¡£ÈçÒÔÏ ......
javaÁ¬½Ó³£¼ûÊý¾Ý¿âµÄÁ¬½Ó×Ö·û´®
1. MySQL(http://www.mysql.com)mm.mysql-2.0.2-bin.jar ;
Class.forName( "org.gjt.mm.mysql.Driver" );
cn = DriverManager.getConnection( "jdbc:mysql://MyDbComputerNameOrIP:3306/myDatabaseName", sUsr, sPwd );
2. PostgreSQL(http://www.de.postgresql.org)pgjdbc2.jar ;
C ......