Here you can find the source of parseYmd(String date)
Parameter | Description |
---|---|
date | a parameter |
public static Date parseYmd(String date)
//package com.java2s; //License from project: Open Source License import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Date; public class Main { /**//from w ww .j ava 2s . c o m * @param date * @return date, parsed as "yyyy-MM-dd" */ public static Date parseYmd(String date) { return parseDate(date, "yyyy-MM-dd"); } /** * Utility method to parse a date in the given format * @param s the string to parse * @param format the date format * @return a Date representing the date in the passed format */ public static Date parseDate(String s, String format) { DateFormat df = new SimpleDateFormat(format); try { return df.parse(s); } catch (Exception e) { throw new RuntimeException("Cannot parse " + s + " into a date using format " + format); } } }