JAVAÖеÄÈÕÆÚ¼ÆËã
һЩÎÞÁĵĴúÂëÖ®Ò»£ºJAVAÖеÄÈÕÆÚ¼ÆËã
/*
* DateCalculate.java , Created on 2005-3-18
* Copyright 2005 AAA Information Technology CO.LTD. All rights reserved.
*
* ×÷³ÉÈÕÆÚ: 2005-3-18
* ÐÞ¸ÄÂÄÀú:
*
*/
package com.bjb.xyh.util;
import java.text.DecimalFormat;
//import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
/**
* ÀàÃèÊö£º×Ô¼ºÊµÏÖµÄÈÕÆÚ¼ÆËãÀ࣬¿ÉÒÔ×ÔÓÉÀ©Õ¹
* @author xieyh lamp5w@yahoo.com.cn
* @version build 2005-3-18
*
*/
public class DateCalculate {
/** ×¢Òâ¸ñÀïÀúºÍÈåÂÔÀú½»½ÓʱµÄÈÕÆÚ²î±ð */
private static transient int gregorianCutoverYear = 1582;
/** ÈòÄêÖÐÿÔÂÌìÊý */
private static final int[] DAYS_P_MONTH_LY=
{31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
/** ƽÄêÖÐÿÔÂÌìÊý */
private static final int[] DAYS_P_MONTH_CY=
{31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
/** ´ú±íÊý×éÀïµÄÄê¡¢Ô¡¢ÈÕ */
private static final int Y = 0, M = 1, D = 2;
/** ²ÎÓëÔËËãÓà */
private int[] ymd = null;
/**
* ¼ì²é´«ÈëµÄ²ÎÊýÊÇ·ñºÏ·¨µÄÈÕÆÚ
* @param date
* @throws IllegalArgumentException
*/
public static void validate(String date)throws IllegalArgumentException{
int[] ymd = splitYMD( date );
if( ymd[M] == 0 || ymd[M] > 12 ){
throw new IllegalArgumentException("Ô·ÝÊýÖµ´íÎó");
}
if( true == isLeapYear( ymd[0] ) ){
if( ymd[D] == 0 || ymd[D] > DAYS_P_MONTH_LY[ymd[M] -1 ] ){
throw new IllegalArgumentException("ÈÕÆÚÊýÖµ´íÎó");
}
}else{
if( ymd[D] == 0 || ymd[D] > DAYS_P_MONTH_CY[ymd[M] -1 ] ){
throw new IllegalArgumentException("ÈÕÆÚÊýÖµ´íÎó");
}
}
}
/**
* ¼ì²é´«ÈëµÄ²ÎÊý´ú±íµÄÄê·ÝÊÇ·ñΪÈòÄê
* @param year
* @return
*/
public static boolean i
Ïà¹ØÎĵµ£º
ºÜ¶àÈË˵C#ÊÇ΢ÈíÓÃÀ´ºÍJava¿¹ºâµÄÎäÆ÷£¬ÒòΪ¶þÕßÔںܴó³Ì¶ÈÉÏÓÐמªÈ˵ÄÏàËÆ£¬¾¡¹ÜÈç´Ë£¬Á½Õß²»Í¬µÄµØ·½Ò²ºÜ¶à£¬Ëùν“ÓÚϸ΢´¦¼û²îÒ씡£ÄÇôÁ½ÕßµÄÏàËƺÍÇø±ð¶¼ÔÚʲôµØ·½ÄØ£¿ÎÒÃÇ´Ó½ñÌ쿪ʼ£¬»á´Ó¸÷¸ö½Ç¶ÈÀ´¶Ô±ÈC#ºÍJavaµÄÌص㣬ϣÍûÄܶÔÕýÔÚѧϰ¡¢Ê¹ÓÃC#µÄÅóÓÑÓÐËù°ïÖú¡£
& Y0 f! I! a4 a1 K
% B# G8 ......
ÔÚJavaµÄÊÀ½çÀÎÞÂÛÀ໹ÊǸ÷ÖÖÊý¾Ý£¬Æä½á¹¹µÄ´¦ÀíÊÇÕû¸ö³ÌÐòµÄÂß¼ÒÔ¼°ÐÔÄܵĹؼü¡£ÓÉÓÚ±¾È˽Ӵ¥ÁËÒ»¸öÓйØÐÔÄÜÓëÂ߼ͬʱ²¢´æµÄÎÊÌ⣬ÓÚÊǾͿªÊ¼Ñо¿Õâ·½ÃæµÄÎÊÌâ¡£ÕÒ±éÁË´ó´óССµÄÂÛ̳£¬Ò²°Ñ¡¶Java ÐéÄâ»ú¹æ·¶¡·£¬¡¶apress,.java.collections.(2001),.bm.ocr.6.0.shareconnector¡·£¬ºÍ¡¶Thinking in Java¡··ÁËÒ²ÕÒ²»µ ......
Ó¢ÎÄÔÎĵØÖ·:
http://www.onjava.com/pub/a/onjava/2005/07/06/generics.html
ÖÐÎĵØÖ·:
http://www.matrix.org.cn/resource/article/43/43634_java_generics.html
¹Ø¼ü´Ê£º java generics java5
ÕªÒª
·ºÐÍÊÇJ2SE 5.0×îÖØÒªµÄÌØÐÔ¡£ËûÃÇÈÃÄãдһ¸ötype(Àà»ò½Ó¿Ú£©ºÍ´´½¨Ò»¸ö ......
JavaÖÐÌṩÁ˷ḻµÄÈÕÆÚ±íʾ·½Ê½¡£ÆäÖаüÀ¨Date¡¢Timestamp¡¢Calendar¡¢GregorianCalendarÀà¡£GregorianCalendarÀàÖÐÌṩÁËÓÃÓÚ¼ÆËãÈÕÆÚµÄadd()·½·¨£¬¿ÉÒԺܷ½±ãµØ¼ÆËãÈô¸ÉÄê¡¢Ô¡¢ÈÕºóµÄÈÕÆÚ¡£
¸ø¸öÀý×Ó¿´¿´£º
package testjava;
import java.sql.Timestamp;
import java.text.SimpleDateFormat;
import ......