Java Today todayStart()

Here you can find the source of todayStart()

Description

today Start

License

Apache License

Declaration

public static Date todayStart() 

Method Source Code


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

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

public class Main {
    public static Date todayStart() {
        return getDateWithoutTimePart(new Date());
    }//from  www.  j a  v a2s  . c  o m

    public static Date todayStart(Date date) {
        return getDateWithoutTimePart(date);
    }

    public static Date getDateWithoutTimePart(Date date) {

        Calendar cal = Calendar.getInstance();
        cal.setTime(date);
        cal.set(Calendar.HOUR_OF_DAY, 0);
        cal.set(Calendar.MINUTE, 0);
        cal.set(Calendar.SECOND, 0);
        cal.set(Calendar.MILLISECOND, 0);
        return cal.getTime();

    }
}

Related

  1. todayMinute()
  2. todayPlusDays(int days)
  3. toDaysBeforeOrAfter(Date date, Integer days)
  4. todaysDate(int style)
  5. todaySortedTimestamp()
  6. todaysTime()
  7. todayStr()
  8. todayString(final String sFormat)
  9. translateToDayNumber(int y, int m, int d)