Java SQL Time Calculate getMidNightTime()

Here you can find the source of getMidNightTime()

Description

get Mid Night Time

License

BSD License

Declaration

public static Date getMidNightTime() 

Method Source Code

//package com.java2s;
/*******************************************************************************
 * Copyright Duke Comprehensive Cancer Center and SemanticBits
 * /*from  w  w  w . ja v a2 s  . c om*/
 * Distributed under the OSI-approved BSD 3-Clause License.
 * See http://ncip.github.com/c3pr/LICENSE.txt for details.
 ******************************************************************************/

import java.sql.Time;

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

public class Main {
    public static Date getMidNightTime() {
        java.util.Calendar cal = new java.util.GregorianCalendar();
        cal.add(Calendar.DATE, 1);
        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();
    }

    public static Time getTime(Date date) {
        return new Time(date.getTime());
    }
}

Related

  1. addTimeToDate(Date dt)
  2. appendTime(StringBuffer sb, Calendar cal, int nanos)
  3. getDifference(Time timeFrom, Time timeTo)
  4. getDiffTime(String _fromDate, String _fromTime, String _toDate, String _toTime)
  5. getExpiresTime(Long validityPeriod)
  6. getMinute(Time time)
  7. getMonth(String dateTime)
  8. getMonth(String dateTime)
  9. getNewFileList(String path, String mintime)