Android Time Parse parseTimeString(final String time)

Here you can find the source of parseTimeString(final String time)

Description

Takes a string of the form [HH:]MM:SS[.mmm] and converts it to milliseconds.

License

Open Source License

Declaration

public static long parseTimeString(final String time) 

Method Source Code

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

public class Main {
    /**//from w  ww.j  a va  2  s.  com
     * Takes a string of the form [HH:]MM:SS[.mmm] and converts it to
     * milliseconds.
     */
    public static long parseTimeString(final String time) {
        String[] parts = time.split(":");
        long result = 0;
        int idx = 0;
        if (parts.length == 3) {
            // string has hours
            result += Integer.valueOf(parts[idx]) * 3600000L;
            idx++;
        }
        result += Integer.valueOf(parts[idx]) * 60000L;
        idx++;
        result += (Float.valueOf(parts[idx])) * 1000L;
        return result;
    }
}

Related

  1. isRFC3339Date(String date)
  2. parseTime(String time)
  3. str2Time(String str)
  4. str2TimeMillis(String str)
  5. time(String tag)
  6. toModifiedTimeDate(double modDouble)