Here you can find the source of toTimeStampString(String timeStr)
public static String toTimeStampString(String timeStr)
//package com.java2s; //License from project: Apache License public class Main { public static String toTimeStampString(String timeStr) { String result = ""; // TimeZone tz = TimeZone.getDefault(); // GregorianCalendar c = new GregorianCalendar(tz); result += timeStr.substring(0, 4); result += "-"; result += timeStr.substring(4, 6); result += "-"; result += timeStr.substring(6, 8); if (timeStr.length() > 8) { result += " " + timeStr.substring(8, 10); result += ":"; result += timeStr.substring(10, 12); result += ":"; result += timeStr.substring(12, 14); }//from w w w. j a v a2 s . c o m return result; } }