Java Day getDayBegin(Date date)

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

Description

get Day Begin

License

Open Source License

Declaration

public static Date getDayBegin(Date date) 

Method Source Code


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

import java.util.Date;

public class Main {

    public static Date getDayBegin(Date date) {
        DateFormat df = new SimpleDateFormat("yyyyMMdd");
        df.setLenient(false);/*from  w ww .j a  v  a  2 s . c  o m*/

        String dateString = df.format(date);

        try {
            return df.parse(dateString);
        } catch (ParseException e) {
            return null;
        }
    }

    public static String format(Date date, String format) {
        if (date == null) {
            return null;
        }
        return new SimpleDateFormat(format).format(date);
    }
}

Related

  1. getDay(String string)
  2. getDay(String tempdat, Locale locale)
  3. getDayAfter(String dateformat, String day, int filed, int delta)
  4. getDayAfterTommorrowsDateFne()
  5. getDayBefore(Date date)
  6. getDayBetween(String firstDay, String secondDay)
  7. getDayDate(String date, String formatFormat)
  8. getDayDesc(Date arg)
  9. getDayEnd(Date date)