Java SQL Date Create getCurrentDayStartDate(Date date)

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

Description

get Current Day Start Date

License

Open Source License

Declaration

public static Timestamp getCurrentDayStartDate(Date date) 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.sql.Timestamp;

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

public class Main {

    public static Timestamp getCurrentDayStartDate(Date date) {
        Calendar rightNow = Calendar.getInstance();
        rightNow.setTime(date);//from  w  ww. java  2 s  .  co  m
        rightNow.set(Calendar.HOUR_OF_DAY, 0);
        rightNow.set(Calendar.MILLISECOND, 0);
        rightNow.set(Calendar.SECOND, 0);
        rightNow.set(Calendar.MINUTE, 0);
        rightNow.set(Calendar.MONTH, rightNow.get(Calendar.MONTH));
        return new Timestamp(rightNow.getTimeInMillis());
    }
}

Related

  1. getCurrentDate()
  2. getCurrentDateStart()
  3. getCurrentDateStr(String strFormat)
  4. getCurrentDateString()
  5. getCurrentDateWithMinutePrecision()
  6. getCurrentDBDate()
  7. getCurrentSQLDate()
  8. getCurSQLDate()
  9. getCurSQLDateInString(String pstrDateFormat)