Java tutorial
//package com.java2s; import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static String getTimeDbFormat(String oldTime) throws Exception { SimpleDateFormat displayFormat = new SimpleDateFormat("HH:mm:ss"); SimpleDateFormat parseFormat = new SimpleDateFormat("hh:mm a"); Date date = parseFormat.parse(oldTime); return displayFormat.format(date); } }