Android Time to Milliseconds Convert time2LongMillis(String timestr)

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

Description

time Long Millis

Declaration

public static long time2LongMillis(String timestr) 

Method Source Code

//package com.java2s;

public class Main {

    public static long time2LongMillis(String timestr) {
        String[] times = timestr.split(":");
        if (times.length == 1) {
            return Long.parseLong(times[0]) * 1000;
        } else if (times.length == 2) {
            return (Long.parseLong(times[0]) * 60 + Long
                    .parseLong(times[1])) * 1000;
        } else if (times.length == 3) {
            return (Long.parseLong(times[0]) * 3600
                    + Long.parseLong(times[1]) * 60 + Long
                        .parseLong(times[2])) * 100;
        } else {/* w  w w. ja  v  a 2  s .c  o m*/
            return 0;
        }
    }
}

Related

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