根據某天或某月是否是節假休息日

官網: http://www.easybots.cn/holiday_api.net


public class HolidayUtils {

    /**
     * 檢查一個||多個日期是否爲節假日(0工作日, 1休息日, 2節假日):
     *
     * @param days 20130101 || 20130101,20130103
     */
    public static String checkHolidayByDays(String days) {
        //{"20130101":"2","20130103":"2","20130105":"2","20130201":"2"}
        String url = "http://www.easybots.cn/api/holiday.php?d=" + days;
        try {
            String result = HttpUtils.get(url, null);
            return result;
        } catch (Exception e) {
            return null;
        }
    }

    /**
     * 獲取2013年1/2月份節假日
     *
     * @param months 201301,201302
     */
    public static String checkHolidayByMonths(String months) {
        //{"201301":{"01":"2","02":"2","03":"2","12":"1","13":"2","19":"1","20":"1","26":"1","27":"2"},
        // "201302":{"02":"2","03":"1","09":"2","10":"2","11":"2","12":"1","13":"2","14":"2","15":"2","23":"1","24":"2"}}
        String url = "http://www.easybots.cn/api/holiday.php?m=" + months;
        try {
            String result = HttpUtils.get(url, null);
            return result;
        } catch (Exception e) {
            return null;
        }
    }
}
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章