Here you can find the source of parseYmd(String s)
Parameter | Description |
---|---|
s | the string to parse |
format | the date format |
public static Date parseYmd(String s)
//package com.java2s; //License from project: Open Source License import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.*; public class Main { /**// w w w. ja v a2s . com * 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 parseYmd(String s) { DateFormat df = new SimpleDateFormat("yyyy-MM-dd"); try { return df.parse(s); } catch (Exception e) { throw new RuntimeException("Cannot parse " + s + " into a date using ymd format"); } } }