Java SQL Date Get getDateYYMM(java.sql.Timestamp ts)

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

Description

given timestamp object and return string format of YYMM

License

Open Source License

Parameter

Parameter Description
ts - Timestamp

Return

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

Declaration

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

Method Source Code

//package com.java2s;

public class Main {
    /**/*from  w w w.ja  va 2  s.  co m*/
     * given timestamp object and return string format of YYMM
     * <p/>
     * <p/>
     *
     * @param ts - Timestamp
     * @return String
     *         author    Vincent Yuen
     *         version    %I%, %G%
     */
    public static String getDateYYMM(java.sql.Timestamp ts) {
        String oracleDate = "";
        if (ts != null) {
            oracleDate = ts.toString().substring(2, 4) + ts.toString().substring(5, 7);
        }
        return oracleDate;
    }
}

Related

  1. getDateStart(Date date)
  2. getDateTwo(Date date)
  3. getDateValue(ResultSet result, String strField, String strDateFormat)
  4. getDateValue(ResultSet result, String strField, String strDateFormat)
  5. getDateWithSpecifiedHourAndMinute(Date targetDate, int hour, int minute)