Here you can find the source of parseAMPMFormat(String datetimeString)
public static Timestamp parseAMPMFormat(String datetimeString) throws ParseException
//package com.java2s; //License from project: Open Source License import java.sql.Timestamp; import java.text.DateFormat; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static final String AM_PM_DATETIME_FORMAT = "MM/dd/yyyy hh:mm a"; public static Timestamp parseAMPMFormat(String datetimeString) throws ParseException { DateFormat dateFormat = new SimpleDateFormat(AM_PM_DATETIME_FORMAT); final Date date = dateFormat.parse(datetimeString); return new Timestamp(date.getTime()); }/*from ww w. j ava 2 s .c o m*/ }