Android Time to Milliseconds Convert time2IntMillis(String timestr)

Here you can find the source of time2IntMillis(String timestr)

Description

time Int Millis

Declaration

public static int time2IntMillis(String timestr) 

Method Source Code

//package com.java2s;

public class Main {

    public static int time2IntMillis(String timestr) {
        String[] times = timestr.split(":");
        if (times.length == 1) {
            return Integer.parseInt(times[0]) * 1000;
        } else if (times.length == 2) {
            return (Integer.parseInt(times[0]) * 60 + Integer
                    .parseInt(times[1])) * 1000;
        } else if (times.length == 3) {
            //          return (Integer.parseInt(times[0])*3600+Integer.parseInt(times[1])*60+Integer.parseInt(times[2]))*100;//NumberFormatException: Invalid int: ""
            return 0;
        } else {/*  w  w  w  .j  a  v  a  2  s.c  om*/
            return 0;
        }
    }
}

Related

  1. time2LongMillis(String timestr)
  2. timeStr2Secs(String s)
  3. getTimeinMillis(int year, int month, int day)