Java Date Parse dateFromHourAndMinutes(final String pTime)

Here you can find the source of dateFromHourAndMinutes(final String pTime)

Description

Generate from a date object from a given date-string (HH:mm), like 12:13

License

Open Source License

Parameter

Parameter Description
pTime to convert

Exception

Parameter Description
ParseException if the date can not be transformed

Return

an date representation of the string

Declaration

public static Date dateFromHourAndMinutes(final String pTime) throws ParseException 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.text.ParseException;
import java.text.SimpleDateFormat;

import java.util.Date;

public class Main {
    /**/*ww  w.ja v  a 2  s. c o m*/
     * Generate from a date object from a given date-string (HH:mm), like 12:13
     * 
     * @param pTime
     *          to convert
     * @return an date representation of the string
     * @throws ParseException
     *           if the date can not be transformed
     */
    public static Date dateFromHourAndMinutes(final String pTime) throws ParseException {
        final SimpleDateFormat sdf = new SimpleDateFormat("HH:mm");
        return sdf.parse(pTime);
    }
}

Related

  1. convertTimestampToDateTime(Long timestamp, Boolean withSeconds)
  2. convertTimeZonesToDate(String fromTimeZone, String toTimeZone, DateTime fromDateTime)
  3. convertUTCDateToLocal(String sDate, TimeZone timezone)
  4. convertXMLDate(String date)
  5. dateFromFilename(File file, Pattern fileNamePattern, DateFormat dateFormat)
  6. dateFromISO8601(String iso)
  7. dateFromISO8601(String time)
  8. dateFromISODate(String isoDate)
  9. dateFromString(final String value)