// Collection of code snippets by Arne Vajhøj 
// (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) 
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

public class TimeFormatFun {
    public static void main(String[] args) throws ParseException {
        String tid = "10:54am";
        String dato = "10/17/2011";
        DateFormat indf = new SimpleDateFormat("M/d/yyyy h:mma");
        Date d = indf.parse(dato + " " + tid);
        DateFormat outdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        String stddatotid = outdf.format(d);
        System.out.println(stddatotid);
    }
}
