<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 閱讀(317) 評論(0)  編輯  收藏

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


    網站導航:
     
    主站蜘蛛池模板: 国内精品免费久久影院| 男人免费视频一区二区在线观看| 国产啪精品视频网站免费尤物| 亚洲XX00视频| 美女被免费网站在线视频免费| 免费观看大片毛片| 亚洲欧美国产日韩av野草社区| 成人片黄网站色大片免费| 亚洲大码熟女在线观看| 又大又黄又粗又爽的免费视频| 国产精品亚洲天堂| 亚洲欧洲精品成人久久奇米网 | 免费看国产一级特黄aa大片| 亚洲AV无码片一区二区三区| 亚洲国产成人精品91久久久| 成人无码区免费A∨直播| 亚洲va久久久噜噜噜久久| 99热在线免费观看| 亚洲国产成人久久综合一区| 国产成人免费高清激情视频| 国产精品亚洲一区二区无码| 亚洲日本乱码在线观看| 久久成人免费大片| 亚洲一级毛片在线播放| 日韩精品视频免费网址| 国产免费一区二区三区免费视频| 亚洲成人中文字幕| 成人au免费视频影院| 一级毛片免费在线播放| 亚洲综合无码一区二区| 成人毛片免费观看| 一本大道一卡二大卡三卡免费| 久久亚洲精品中文字幕无码| 永久免费av无码不卡在线观看| 免费精品国产自产拍在线观看 | 日韩精品亚洲aⅴ在线影院| 中文字幕成人免费视频| 亚洲av永久中文无码精品| 亚洲老妈激情一区二区三区| 免费精品人在线二线三线区别 | 久久精品国产亚洲AV大全|