Here you can find the source of parseFromDays(String date)
yyyy-MM-dd
Parameter | Description |
---|---|
date | The date to format |
public static Date parseFromDays(String date)
//package com.java2s; //License from project: Apache License import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; import com.google.common.base.Throwables; public class Main { public static final String FORMAT_TO_DAYS = "yyyy-MM-dd"; /**/* w w w . j a va 2s . co m*/ * Parses a string of the following format to a {@link Date}: * <p> * <code> * yyyy-MM-dd * </code> * * @param date * The date to format * * @return The result */ public static Date parseFromDays(String date) { return parse(getFormatToDays(), date); } private static Date parse(SimpleDateFormat format, String date) { try { return format.parse(date); } catch (ParseException e) { throw Throwables.propagate(e); } } /** * Returns a date format to the resolution of days: * <p> * <code> * yyyy-MM-dd * </code> * * @return The result */ public static SimpleDateFormat getFormatToDays() { return new SimpleDateFormat(FORMAT_TO_DAYS); } }