Java SQL Time Create timeToString(Time time)

Here you can find the source of timeToString(Time time)

Description

Returns the time string of time value.

License

Open Source License

Parameter

Parameter Description
time a <code>Time</code> value

Return

a String value

Declaration

public static String timeToString(Time time) 

Method Source Code


//package com.java2s;
/*//  w w  w .  j a va2  s  .co m
 * Copyright (c) Open Source Strategies, Inc.
 *
 * Opentaps is free software: you can redistribute it and/or modify it
 * under the terms of the GNU Affero General Public License as published
 * by the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * Opentaps 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 Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with Opentaps.  If not, see <http://www.gnu.org/licenses/>.
 */

import java.sql.Time;

import java.text.DateFormat;

import java.text.SimpleDateFormat;

public class Main {
    private static final String TIME_FORMAT = "HH:mm:ss";

    /**
     * Returns the time string of time value.
     * @param time a <code>Time</code> value
     * @return a <code>String</code> value
     */
    public static String timeToString(Time time) {
        DateFormat df = new SimpleDateFormat(TIME_FORMAT);
        return df.format(time);
    }
}

Related

  1. timeToCalendar(Time input)
  2. timeToInternal(java.sql.Time time)
  3. timeToLong(Object timeObj)
  4. timeToString(java.sql.Time a_Time, String aS_Format)
  5. timeToString(Time t)