Java Timestamp to Calendar getCalendarModel(java.sql.Timestamp date)

Here you can find the source of getCalendarModel(java.sql.Timestamp date)

Description

get Calendar Model

License

Apache License

Declaration

public static String getCalendarModel(java.sql.Timestamp date) 

Method Source Code

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

public class Main {
    public static String getCalendarModel(java.sql.Timestamp date) {
        if (date != null) {
            return getHours(date.toString());
        } else {//w w  w . j av a 2s.c  om
            return null;
        }
    }

    public static String getHours(String str) {
        if (str != null) {
            String tmpStr = str.trim();
            int pos = tmpStr.lastIndexOf(":");
            str = str.substring(pos - 5, pos);

            return str;
        } else {
            return null;
        }
    }
}

Related

  1. getCalendar(Timestamp timestamp)
  2. getCalendarFromTimeStamp(Timestamp t)
  3. getCalendarOfTimestamp( java.sql.Timestamp tTimestamp, Locale locale)