Java SQL Time parseAMPMFormat(String datetimeString)

Here you can find the source of parseAMPMFormat(String datetimeString)

Description

parse AMPM Format

License

Open Source License

Declaration

public static Timestamp parseAMPMFormat(String datetimeString) throws ParseException 

Method Source Code


//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*/
}

Related

  1. merge(java.util.Date date, java.util.Date time)
  2. mergeDateTime(Date date, Time time)
  3. minTime()
  4. minutesToTime(int minutes)
  5. parse(String dateTimeString)
  6. parseCalendar(final TimeZone timezone, final Locale locale, final String dateformat, final String datestring)
  7. parseDate(String datetime, String format)
  8. readTime(ByteBuffer buffer)
  9. removeTimefromDate(Date inputDate)