Java Parse Time parseTimeConfiguration(String time)

Here you can find the source of parseTimeConfiguration(String time)

Description

parse Time Configuration

License

Apache License

Declaration

public static Date parseTimeConfiguration(String time) throws ParseException 

Method Source Code


//package com.java2s;
//License from project: Apache License 

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

import java.util.Date;

public class Main {
    private static final SimpleDateFormat TIME_FORMAT_WITHOUT_SECONDS = new SimpleDateFormat("HH:mm");
    public static final SimpleDateFormat TIME_FORMAT_WITHOUT_SECONDS_WITH_TIMEZONE = new SimpleDateFormat("HH:mmZ");

    public static Date parseTimeConfiguration(String time) throws ParseException {
        try {// w  ww.ja v  a  2  s  . co  m
            return TIME_FORMAT_WITHOUT_SECONDS_WITH_TIMEZONE.parse(time);
        } catch (ParseException ex) {
            return TIME_FORMAT_WITHOUT_SECONDS.parse(time);
        }
    }
}

Related

  1. parseTime(String time)
  2. parseTime(String time, String formatStrBefore, String formatStrAfter)
  3. parseTime(String timestring)
  4. parseTime(String timeString, TimeZone timeZone)
  5. parseTime(String token)
  6. parseTimeSpec(String[] spec)
  7. parseTimeStr(String timeStr)
  8. parseTimeString(String time)
  9. parseTimeString(String timeString)