Java Day of parseDay(Date value, String defaultValue)

Here you can find the source of parseDay(Date value, String defaultValue)

Description

Parses the day field from the given date.

License

Open Source License

Parameter

Parameter Description
value the date value to parse
defaultValue the default value returned

Return

the day value, or the default for null dates

Declaration

public static String parseDay(Date value, String defaultValue) 

Method Source Code


//package com.java2s;
import java.text.SimpleDateFormat;

import java.util.Date;

public class Main {
    /**/*from w w w  .  ja v  a 2  s . c  om*/
     * Parses the day field from the given date.
     *
     * @param value the date value to parse
     * @param defaultValue the default value returned
     * @return the day value, or the default for null dates
     */
    public static String parseDay(Date value, String defaultValue) {
        if (value == null) {
            return defaultValue;
        }
        return new SimpleDateFormat("d").format(value);
    }
}

Related

  1. minusDate(int day, int type)
  2. nextDay(Date date)
  3. nowDayString()
  4. parseBirthday(String r)
  5. parseCalendarDayFormat(String strDate)
  6. parseDay(final String day)
  7. parseDay(int time)
  8. parseDay(String str, String type)
  9. parseDayTime(long ts)