Java SQL Time resetDayTime(Time date)

Here you can find the source of resetDayTime(Time date)

Description

reset Day Time

License

LGPL

Declaration

public static Time resetDayTime(Time date) 

Method Source Code


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

import java.sql.Time;

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

public class Main {
    public static Time resetDayTime(Time date) {
        Time result = null;//from   w  w w  .jav a  2s.  c  o m
        result = (date != null ? new Time(resetDay(date).getTime()) : null);
        return result;
    }

    public static Date resetDay(Date date) {
        Date result = null;
        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. parseAMPMFormat(String datetimeString)
  2. parseCalendar(final TimeZone timezone, final Locale locale, final String dateformat, final String datestring)
  3. parseDate(String datetime, String format)
  4. readTime(ByteBuffer buffer)
  5. removeTimefromDate(Date inputDate)
  6. resetNetworkTimeout(Connection rawConnection, Executor executor, int oldTimeout)
  7. roundDatetimeValue(Object value)
  8. roundSmallDateTimeValue(Object value)
  9. saveGameScores(String gameName, String player1, String player2, String player3, String player4, short score1, short score2, short score3, short score4, java.util.Date startTime)