Java SQL Time Create timeToString(java.sql.Time a_Time, String aS_Format)

Here you can find the source of timeToString(java.sql.Time a_Time, String aS_Format)

Description

Converts java.sql.Timestamp to String with using specified format

License

Open Source License

Parameter

Parameter Description
a_Timestamp Timestamp containing time
aS_Format String containing format specifications

Return

String containing datetime

Declaration


public static String timeToString(java.sql.Time a_Time, String aS_Format) 

Method Source Code

//package com.java2s;
/*/*  w  w w  .ja  v  a  2 s  .co  m*/
NetForm Library
---------------
Copyright (C) 2001-2005 - Sampsa Sohlman, Teemu Sohlman
    
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.text.SimpleDateFormat;

public class Main {
    /**
     * Converts java.sql.Timestamp to String with using specified format
     * @param a_Timestamp Timestamp containing time
     * @param aS_Format String containing format specifications
     * @return String containing datetime
     *
     * @see java.text.SimpleDateFormat for format options
     */

    public static String timeToString(java.sql.Time a_Time, String aS_Format) {
        if (a_Time == null)
            return "";

        SimpleDateFormat l_SimpleTimeFormat = new SimpleDateFormat(aS_Format);

        return l_SimpleTimeFormat.format(a_Time);
    }
}

Related

  1. time2String(final java.sql.Time value)
  2. timeToBytes(Time t)
  3. timeToCalendar(Time input)
  4. timeToInternal(java.sql.Time time)
  5. timeToLong(Object timeObj)
  6. timeToString(Time t)
  7. timeToString(Time time)