<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;

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

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

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

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

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

        
    /**
         * 在年月的基礎上加上或減去月份得到新年月
         
    */
        @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;
            }
        }

        
    /**
         * 取得一個月中有多少天
         * 
         * 
    @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;
            
        }
        
        
    /**
         * 取得每個月的第一天是周幾
         * 
    @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 閱讀(322) 評論(0)  編輯  收藏

    只有注冊用戶登錄后才能發表評論。


    網站導航:
     
    主站蜘蛛池模板: 亚洲毛片基地日韩毛片基地| 久99久无码精品视频免费播放| 亚洲av最新在线网址| 国产成人免费a在线资源| 国产曰批免费视频播放免费s| A毛片毛片看免费| 成人婷婷网色偷偷亚洲男人的天堂| 久久久久久亚洲精品成人| 日韩亚洲变态另类中文| 免费一区二区视频| 午夜视频在线观看免费完整版| h在线观看视频免费网站| 成全在线观看免费观看大全| www.xxxx.com日本免费| 麻豆91免费视频| 久久亚洲AV成人无码国产电影| 亚洲a级成人片在线观看| 亚洲第一成年人网站| 亚洲国产国产综合一区首页| 亚洲精品乱码久久久久久| 亚洲性日韩精品一区二区三区| 国产一区二区三区免费看| 日本a级片免费看| 香蕉视频在线观看免费国产婷婷| 中国在线观看免费高清完整版| 国产人成免费视频网站| 67194成手机免费观看| 2020因为爱你带字幕免费观看全集| 欧洲人免费视频网站在线| 免费网站看av片| 精品国产免费一区二区三区香蕉 | 猫咪免费人成在线网站| 亚洲国产成人AV网站| 精品亚洲av无码一区二区柚蜜| 亚洲爆乳无码专区www| 亚洲精品成a人在线观看☆| 丰满亚洲大尺度无码无码专线| 美女隐私免费视频看| gogo免费在线观看| 97超高清在线观看免费视频| 黄色网址在线免费|