Java Timestamp Convert To toEnglishHours(java.sql.Timestamp ts)

Here you can find the source of toEnglishHours(java.sql.Timestamp ts)

Description

given timestamp object and return string format of hh

License

Open Source License

Parameter

Parameter Description
ts - Timestamp

Return

String author Vincent Yuen version %I%, %G%

Declaration

public static String toEnglishHours(java.sql.Timestamp ts) 

Method Source Code

//package com.java2s;

public class Main {
    /**/*from   www  .  j a v a 2 s.co  m*/
     * given timestamp object and return string format of hh
     * <p/>
     * <p/>
     *
     * @param ts - Timestamp
     * @return String
     *         author    Vincent Yuen
     *         version    %I%, %G%
     */
    public static String toEnglishHours(java.sql.Timestamp ts) {
        String hours = "";
        if (ts != null) {
            hours = ts.toString();
            int index = hours.indexOf(":");
            hours = hours.substring(index - 2, index);
        }
        return hours;
    }
}

Related

  1. toDate(java.sql.Timestamp timestamp)
  2. toDate(Timestamp timestamp)
  3. toDateTime(Timestamp value)
  4. toDecimal(Timestamp instant)
  5. toEnglishDateTime(java.sql.Timestamp ts)
  6. toEPICSTime(java.sql.Timestamp timestamp)
  7. toFormatedString(final Timestamp ts, final String timeZoneId)
  8. toGmtTimestampString(Timestamp timestamp)
  9. toInstant(final Timestamp timestamp)