Here you can find the source of formatToDays(Date date)
yyyy-MM-dd
Parameter | Description |
---|---|
date | The date to format |
public static String formatToDays(Date date)
//package com.java2s; //License from project: Apache License import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static final String FORMAT_TO_DAYS = "yyyy-MM-dd"; /**/* www . java2s . co m*/ * Formats a {@link Date} to the resolution of days: * <p> * <code> * yyyy-MM-dd * </code> * * @param date * The date to format * * @return The result */ public static String formatToDays(Date date) { return getFormatToDays().format(date); } /** * 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); } }