Java SQL Time getDBTime(String yyyyMMddHHmmss)

Here you can find the source of getDBTime(String yyyyMMddHHmmss)

Description

get DB Time

License

Open Source License

Parameter

Parameter Description
tmpTime 2008042112300

Return

"2008-04-21 12:30:00.0"

Declaration

public static String getDBTime(String yyyyMMddHHmmss) 

Method Source Code

//package com.java2s;

import java.text.SimpleDateFormat;

public class Main {
    /**//from  ww  w  .  j av a 2 s.c  o  m
     * @param tmpTime
     *            2008042112300
     * @return "2008-04-21 12:30:00.0"
     */
    public static String getDBTime(String yyyyMMddHHmmss) {
        String d = "";
        try {
            SimpleDateFormat temp = new SimpleDateFormat("yyyyMMddHHmmss");
            d = new java.sql.Timestamp(temp.parse(yyyyMMddHHmmss).getTime()).toString();
        } catch (Exception ex) {
            ex.printStackTrace();
        }
        return d;
    }
}

Related

  1. extractTime(Date date)
  2. getCalTime(Time startTime, Calendar cal)
  3. getClassForSqlType(String sqlType, Class dateTimeClass)
  4. getClosestIDByTime(Connection con, String table, long time)
  5. getDateTimeValue(ResultSet result, String strField, String strDateFormat)
  6. getFormatDateTimeDesc(long longDate)
  7. getFullDateTime(ResultSet rs, String column)
  8. getFutureTime(int month)
  9. getGrandfatheredTime()