Java tutorial
//package com.java2s; public class Main { public static final String parseDateTime1(String timeStr) { StringBuffer sb = new StringBuffer(); sb.append(timeStr.substring(0, 4)).append("-").append(timeStr.substring(4, 6)).append("-") .append(timeStr.substring(6, 8)).append(" ").append(timeStr.substring(8, 10)).append(":") .append(timeStr.substring(10, 12)).append(":").append(timeStr.substring(12, 14)); return sb.toString(); } }