The list of methods to do Parse Time are organized into topic(s).
Calendar
parseTime(Calendar c, String time) return a calendar from a cal and time
if (time.matches("\\d(\\d)?:\\d(\\d)?")) {
SimpleDateFormat sdf = new SimpleDateFormat("HH:mm");
c.setTime(sdf.parse(time));
return c;
} else {
return null;
Date
parseTime(char[] timeChars) Parse a time character array as defined in PKCS#11 and return is as a Date object.
Date time = null;
if ((timeChars != null) && timeChars.length > 2) {
String timeString = new String(timeChars, 0, timeChars.length - 2);
try {
SimpleDateFormat utc = new SimpleDateFormat("yyyyMMddhhmmss");
utc.setTimeZone(TimeZone.getTimeZone("UTC"));
time = utc.parse(timeString);
} catch (ParseException ex) {
...
long
ParseTime(final String time) Parse Time
final String[] timeString = time.split(":");
int hour = Integer.parseInt(timeString[0]), minute = Integer.parseInt(timeString[1]),
second = Integer.parseInt(timeString[2]);
Calendar now = new GregorianCalendar();
now.set(Calendar.HOUR_OF_DAY, hour);
now.set(Calendar.MINUTE, minute);
now.set(Calendar.SECOND, second);
return now.getTimeInMillis();
...
Date
parseTime(String currDate, String format) parse Time
SimpleDateFormat dtFormatdB = null;
try {
dtFormatdB = new SimpleDateFormat(format);
return dtFormatdB.parse(currDate);
} catch (Exception e) {
dtFormatdB = new SimpleDateFormat("HH:mm:ss");
try {
return dtFormatdB.parse(currDate);
...
Date
parseTime(String date, String format) parse Time
if (date == null) {
return null;
try {
return new SimpleDateFormat(format).parse(date);
} catch (ParseException e) {
throw new RuntimeException(e);
Date
parseTime(String s) Parses text in 'HH:mm:ss' format to produce a time.
return FORMAT_HMS.parse(s);
java.util.Date
parseTime(String sTime) Parse the given time ( supposed to be in ISO format : "HH:MM:SS" )
if (sTime == null)
return null;
if (sTime.length() == 0)
return null;
char c = 0;
for (int i = 0; i < 8; i++)
c = sTime.charAt(i);
...
Date
parseTime(String str) Parses time of day in hh:mm aa format.
ParsePosition pos = new ParsePosition(0);
Date result = timeFormatter.parse(str, pos);
if ((result != null) && (pos.getIndex() < str.length()))
result = null;
if (result == null) {
pos = new ParsePosition(0);
result = timeFormatter2.parse(str, pos);
if ((result != null) && (pos.getIndex() < str.length()))
...
Date
parseTime(String str) Parse the time from a string and return it.
Date date = null;
try {
date = DateFormat.getTimeInstance(DateFormat.FULL).parse(str);
} catch (ParseException pel) {
try {
date = DateFormat.getTimeInstance(DateFormat.LONG).parse(str);
} catch (ParseException pe2) {
try {
...
Date
parseTime(String t) Parse a time string in one of the supported formats.
for (DateFormat df : TIME_FORMATS) {
try {
return df.parse(t);
} catch (ParseException e) {
} catch (NumberFormatException e) {
return null;
...