Java Date Set resetDay(Date date)

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

Description

reset Day

License

LGPL

Declaration

public static Date resetDay(Date date) 

Method Source Code

//package com.java2s;
//License from project: LGPL 

import java.util.Calendar;
import java.util.Date;

public class Main {
    public static Date resetDay(Date date) {
        Date result = null;/*from   ww  w  .j  a  v a2s. c o  m*/
        if (date != null) {
            Calendar calendar = Calendar.getInstance();

            calendar.setTime(date);
            calendar.set(Calendar.DAY_OF_MONTH, 1);
            calendar.set(Calendar.MONTH, 0);
            calendar.set(Calendar.YEAR, 1970);

            result = calendar.getTime();
        }
        return result;
    }
}

Related

  1. resetHourMinSecMill(Date date)
  2. resetTime(Date date)
  3. resetTime(Date dt)
  4. setDate(Date date, int year, int month, int day)