Java SQL Time From toTime(final Date date)

Here you can find the source of toTime(final Date date)

Description

to Time

License

Apache License

Declaration

public static Time toTime(final Date date) 

Method Source Code

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

import java.sql.Time;

import java.util.Calendar;

import java.util.Date;

public class Main {
    public static Time toTime(final int hour, final int minute, final int second) {

        Calendar cal = Calendar.getInstance();
        cal.set(1970, 0, 1, hour, minute, second);
        cal.set(Calendar.MILLISECOND, 0);
        return new Time(cal.getTime().getTime());
    }/*from  ww w  .  j a v  a2 s . c  o m*/

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

Related

  1. toDatetime(long value)
  2. toDateTimeString(java.util.Date inDate)
  3. toSQLTime(final LocalTime lt)
  4. toSqlTime(long date)
  5. toTime(Date value)
  6. toTime(final Object value)
  7. toTime(int value)
  8. toTime(java.util.GregorianCalendar cal)
  9. toTime(LocalTime localTime)