Here you can find the source of parseFullDate(String paramName, String dateStr)
Parameter | Description |
---|---|
paramName | a parameter |
dateStr | a parameter |
public static Calendar parseFullDate(String paramName, String dateStr) throws IllegalArgumentException
//package com.java2s; //License from project: Open Source License import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; public class Main { private static final SimpleDateFormat DATE_FORMAT = new SimpleDateFormat("dd.MM.yyyy HH:mm:ss"); /**/* www . j a v a 2s .com*/ * Tries to parse full formated date. Throws exception if fails. * * @param paramName * @param dateStr * @return */ public static Calendar parseFullDate(String paramName, String dateStr) throws IllegalArgumentException { Calendar day; try { day = Calendar.getInstance(); Date date = DATE_FORMAT.parse(dateStr); day.setTime(date); } catch (Exception e) { throw new IllegalArgumentException( "Unparsable \"" + paramName + "\". Must be in format " + DATE_FORMAT.toPattern(), e); } return day; } }