Java SQL Time From toTime(java.util.GregorianCalendar cal)

Here you can find the source of toTime(java.util.GregorianCalendar cal)

Description

Converts a GregorianCalendar into a java.sql.Time.

License

Open Source License

Parameter

Parameter Description
cal the calendar

Return

the time of day

Declaration

public static Time toTime(java.util.GregorianCalendar cal) 

Method Source Code

//package com.java2s;
/**/*ww  w  .java2  s .c om*/
 * Tentackle - a framework for java desktop applications
 * Copyright (C) 2001-2008 Harald Krake, harald@krake.de, +49 7722 9508-0
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

import java.sql.Time;

public class Main {
    /**
     * Converts a java.util.Date into a java.sql.Time.
     * 
     * @param date the date
     * @return the time of the day in date
     */
    public static Time toTime(java.util.Date date) {
        return date == null ? null : new Time(date.getTime());
    }

    /**
     * Converts a GregorianCalendar into a java.sql.Time.
     * @param cal the calendar
     * @return the time of day
     */
    public static Time toTime(java.util.GregorianCalendar cal) {
        return cal == null ? null : new Time(cal.getTime().getTime());
    }
}

Related

  1. toSqlTime(long date)
  2. toTime(Date value)
  3. toTime(final Date date)
  4. toTime(final Object value)
  5. toTime(int value)
  6. toTime(LocalTime localTime)
  7. toTime(LocalTime localTime)
  8. toTime(Object object, Object oDefault)
  9. toTime(Object value)