Here you can find the source of parseCalendarDayFormat(String strDate)
Parameter | Description |
---|---|
strDate | a parameter |
public static synchronized Calendar parseCalendarDayFormat(String strDate)
//package com.java2s; //License from project: Apache License import java.text.*; import java.util.*; public class Main { private static SimpleDateFormat sdf = new SimpleDateFormat(); /**/*from w ww . j av a 2 s.com*/ * @param strDate * @return java.util.Calendar */ public static synchronized Calendar parseCalendarDayFormat(String strDate) { String pattern = "yyyy-MM-dd"; return parseCalendarFormat(strDate, pattern); } /** * @param strDate * @return java.util.Calendar */ public static synchronized Calendar parseCalendarFormat(String strDate) { String pattern = "yyyy-MM-dd HH:mm:ss"; return parseCalendarFormat(strDate, pattern); } /** * @param strDate * @param pattern * @return java.util.Calendar */ public static synchronized Calendar parseCalendarFormat(String strDate, String pattern) { synchronized (sdf) { Calendar cal = null; sdf.applyPattern(pattern); try { sdf.parse(strDate); cal = sdf.getCalendar(); } catch (Exception e) { } return cal; } } public static synchronized Calendar getCalendar() { return GregorianCalendar.getInstance(); } }