Here you can find the source of str2Calendar(String pString)
Converts a string to a Calendar object
Parameter | Description |
---|---|
pString | A string representing a Calendar |
public static Calendar str2Calendar(String pString)
//package com.java2s; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.*; public class Main { /**/*from w ww . j ava 2 s .c o m*/ * <p>Converts a string to a Calendar object</p> * * @param pString A string representing a Calendar * @return Calendar */ public static Calendar str2Calendar(String pString) { Calendar cal = null; if (pString != null) { try { SimpleDateFormat sdf = new SimpleDateFormat("MM/dd/yyyy"); Date d = sdf.parse(pString); cal = Calendar.getInstance(); cal.setTime(d); } catch (ParseException e) { } } return cal; } }