資源描述:
《java日期轉(zhuǎn)換通用類》由會(huì)員上傳分享,免費(fèi)在線閱讀,更多相關(guān)內(nèi)容在應(yīng)用文檔-天天文庫。
1、importjava.text.DateFormat;importjava.text.ParseException;importjava.text.SimpleDateFormat;importjava.util.Calendar;importjava.util.Date;importjava.util.GregorianCalendar;/***日期處理共通類**@authortangsl*@2012-05-21*/publicclassDateUtil{/***日期格式化*/publicstaticf
2、inalSimpleDateFormatYYYY_MM_DD=newSimpleDateFormat("yyyy-MM-dd");/***月格式化*/publicstaticfinalSimpleDateFormatYYYY_MM=newSimpleDateFormat("yyyy-MM");/***年格式化*/publicstaticfinalSimpleDateFormatYYYY=newSimpleDateFormat("yyyy");/***年月日分格式化*/publicstaticfinalSi
3、mpleDateFormatYYYYMMDDHHMM=newSimpleDateFormat("yyyyMMddHHmm");/***年*/publicstaticfinalintYEAR=1;/***月*/publicstaticfinalintMONTH=2;/***日*/publicstaticfinalintDAY=3;/***時(shí)*/publicstaticfinalintHOUR=4;/***分*/publicstaticfinalintMINUTE=5;/***秒*/publicstaticf
4、inalintSECOND=6;/**yyyy-MM-dd.*/publicstaticfinalStringDATE_FORMAT_ONE="yyyy-MM-dd";/**yyyy/MM/dd.*/publicstaticfinalStringDATE_FORMAT_TWO="yyyy/MM/dd";/**yyyyMMdd.*/publicstaticfinalStringDATE_FORMAT_THREE="yyyyMMdd";/**yyyyMM.*/publicstaticfinalStringDA
5、TE_FORMAT_FOUR="yyyyMM";/**yyyy-MM-ddHH:mm:ss.*/publicstaticfinalStringDATE_FORMAT_FIVE="yyyy-MM-ddHH:mm:ss";/**yyyy.*/publicstaticfinalStringDATE_FORMAT_SIX="yyyy";/**MM.*/publicstaticfinalStringDATE_FORMAT_SEVEN="MM";/**yyyy/MM/ddHH:mm:ss.*/publicstatic
6、finalStringDATE_FORMAT_EIGHT="yyyy/MM/ddHH:mm:ss";/**HH:mm:ss.*/publicstaticfinalStringDATE_FORMAT_NINE="HH:mm:ss";/**yy/MM/dd.*/publicstaticfinalStringDATE_FORMAT_TEN="yy/MM/dd";/**yyyy/M/d.*/publicstaticfinalStringDATE_FORMAT_ELEVEN="yyyy/M/d";/**yyyy/M
7、M.*/publicstaticfinalStringDATE_FORMAT_TWELEVE="yyyy/MM";/**yyyyMMddHHmmssSSS.*/publicstaticfinalStringDATE_FORMAT_THIRTEEN="yyyyMMddHHmmssSSS";/**yyMMdd.*/publicstaticfinalStringDATE_FORMAT_FOURTEEN="yyMMdd";/**yyyy.MM.dd.*/publicstaticfinalStringDATE_FO
8、RMAT_SIXTEEN="yyyy.MM.dd";/**yyyyMMddHHmmss.*/publicstaticfinalStringDATE_FORMAT_SEVENTEEN="yyyyMMddHHmmss";/**yyyy年MM月dd日*/publicstaticfinalStringDATE_FORMAT_EIGHTEEN="yyyy年MM月dd日";/**HH:mm.*/publicstaticfinalStrin