Java Milliseconds Parse parseMillisecond(String date)

Here you can find the source of parseMillisecond(String date)

Description

parse Millisecond

License

Open Source License

Declaration

public static int parseMillisecond(String date) 

Method Source Code

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

public class Main {

    public static int parseMillisecond(String date) {
        String[] tt = date.split("[^\\d]+");
        int ms = 0;
        for (int i = 0; i < tt.length - 1; i++) {
            ms = ms * 60 + getInt(tt[i]);
        }//from   w ww.j  a v  a 2s .c  o m
        ms = ms * 1000 + getInt(tt[tt.length - 1]);
        return ms;
    }

    public static int getInt(String s) {
        if (s != null) {
            try {
                return Integer.parseInt(s);
            } catch (NumberFormatException e) {
                System.err.println("Util.getInt(s): " + e.getMessage());
            }
        }
        return 0;
    }
}

Related

  1. getTimeMillis(long FileTimestamp)
  2. getTimeMillis(String time)
  3. parseDate(long millisec)
  4. parseGMTInMillis(String time)
  5. parseMillis(String s)
  6. parseTimeSpanMillis(final String text)
  7. parseTimeStrToMilliseconds(String timeStr)
  8. parseToMillis(String s)
  9. pauseMilliseconds(long duration)