Java Today formatToDays(Date date)

Here you can find the source of formatToDays(Date date)

Description

Formats a Date to the resolution of days:

yyyy-MM-dd

License

Apache License

Parameter

Parameter Description
date The date to format

Return

The result

Declaration

public static String formatToDays(Date date) 

Method Source Code

//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);
    }
}

Related

  1. createTodayPrefixedDirectory(final String prefix, final File parent)
  2. deletePreviousDay(Calendar today, String temppath)
  3. endOfToday()
  4. formatToday()
  5. formatToday()
  6. getAllToday()
  7. getBetweenTodaysStartDateAndEndDate(Date startDate, Date endDate)
  8. getCalendarTodayZero(Calendar today)
  9. getEndOfToday()