<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    package com.linying.util;

    import java.text.Format;
    import java.text.SimpleDateFormat;
    import java.util.Calendar;
    import java.util.Date;
    import java.util.GregorianCalendar;

    /**
     * 用于日期時(shí)間處理的工具類
     * 
    @author sitinspring
     *
     
    */
    public final class TimeUtil {
        
    private TimeUtil() {

        }
        
        
    /**
         * 取得當(dāng)前日期時(shí)間
         
    */
        
    public static String getShortCurrDateTime() {
            Date date 
    = new Date();
            Format formatter 
    = new SimpleDateFormat("yyyyMMddHHmmss");
            
    return formatter.format(date);
        }
        
        
    /**
         * 取得當(dāng)前日期時(shí)間
         
    */
        
    public static String getCurrDateTime() {
            Date date 
    = new Date();
            Format formatter 
    = new SimpleDateFormat("yyyy年MM月dd日HH時(shí)mm分ss秒");
            
    return formatter.format(date);
        }

     
        
    /**
         * 取得當(dāng)前日期
         
    */
        
    public static String getCurrentDate() {
            Date date 
    = new Date();
            Format formatter 
    = new SimpleDateFormat("yyyy.MM.dd");
            
    return formatter.format(date);
        }
        
        
    /**
         * 取得當(dāng)前年度+月份
         
    */
        
    public static String getCurrentYearMonth() {
            Date date 
    = new Date();
            Format formatter 
    = new SimpleDateFormat("yyyy.MM");
            
    return formatter.format(date);
        }
        
        
    /**
         * 取得當(dāng)前日期
         
    */
        
    public static String getCurrDate() {
            Date date 
    = new Date();
            Format formatter 
    = new SimpleDateFormat("yyyy年MM月dd日");
            
    return formatter.format(date);
        }

        
    /**
         * 取得當(dāng)前時(shí)間
         
    */
        
    public static String getCurrTime() {
            Date date 
    = new Date();
            Format formatter 
    = new SimpleDateFormat("HH時(shí)mm分ss秒");
            
    return formatter.format(date);
        }

        
    /**
         * 取得當(dāng)前年月
         
    */
        
    public static String getCurrMonth() {
            Date date 
    = new Date();
            Format formatter 
    = new SimpleDateFormat("yyyy年MM月");
            
    return formatter.format(date);
        }

        
    /**
         * 在年月的基礎(chǔ)上加上或減去月份得到新年月
         
    */
        @SuppressWarnings(
    "deprecation")
        
    public static String getChangedDate(String strMonth,int monthCount) {
            SimpleDateFormat myFormatter 
    = new SimpleDateFormat("yyyy.MM");

            
    try {
                java.util.Date date 
    = myFormatter.parse(strMonth);
                date.setMonth(date.getMonth()
    +monthCount);
                            
                Format formatter 
    = new SimpleDateFormat("yyyy.MM");
                
    return formatter.format(date);
            } 
    catch (Exception ex) {
                
    return null;
            }
        }

        
    /**
         * 取得一個(gè)月中有多少天
         * 
         * 
    @param strMonth
         * 
    @return
         
    */
        
    public static int getDaysInAMonth(String strMonth) {
            String[] arr
    =strMonth.split("[.]");
            Calendar cal 
    = new GregorianCalendar(Integer.parseInt(arr[0]),Integer.parseInt(arr[1])-11);
            
    int days = cal.getActualMaximum(Calendar.DAY_OF_MONTH); 
            
    return days;
            
        }
        
        
    /**
         * 取得每個(gè)月的第一天是周幾
         * 
    @param strMonth
         * 
    @return
         
    */
        
    public static int getWeekOfFirstDay(String strMonth){
            String[] arr
    =strMonth.split("[.]");
            
            Calendar xmas 
    = new GregorianCalendar(Integer.parseInt(arr[0]),Integer.parseInt(arr[1])-11);
            
    int dayOfWeek = xmas.get(Calendar.DAY_OF_WEEK)-1;    
            
    return dayOfWeek;
        }
    }
    posted on 2010-05-29 17:27 Ying-er 閱讀(317) 評(píng)論(0)  編輯  收藏

    只有注冊(cè)用戶登錄后才能發(fā)表評(píng)論。


    網(wǎng)站導(dǎo)航:
     
    主站蜘蛛池模板: 搡女人免费视频大全| 亚洲三级中文字幕| 国产成人精品免费直播| 69视频在线观看免费| www.av在线免费观看| www亚洲精品久久久乳| 久9久9精品免费观看| 窝窝影视午夜看片免费| 中文字幕亚洲精品无码| 亚洲精品综合一二三区在线| 亚洲成av人片不卡无码久久| 日韩特黄特色大片免费视频| 国产亚洲成在线播放va| 日韩亚洲产在线观看| 亚洲人成777在线播放| 亚洲韩国—中文字幕| 亚洲av永久无码精品国产精品| 亚洲国产一区二区视频网站| 四虎影视免费永久在线观看| 免费观看毛片视频| 国产免费av片在线看| www在线观看免费视频| 免费无码婬片aaa直播表情| 久久无码av亚洲精品色午夜| 亚洲精品无码久久久久久| 亚洲一级免费毛片| 国产成+人+综合+亚洲专| 亚洲午夜电影一区二区三区| 亚洲国产成人资源在线软件 | 亚洲网址在线观看| 亚洲成色WWW久久网站| 国产亚洲av片在线观看16女人| 国产亚洲情侣一区二区无| 综合亚洲伊人午夜网 | 亚洲日本久久久午夜精品| 国产精品亚洲专区在线观看| 色偷偷亚洲女人天堂观看欧| 四虎必出精品亚洲高清| 亚洲av无码专区在线电影天堂 | 91九色精品国产免费| 国产片AV片永久免费观看|