code: static public long parseTime(final String text) throws NumberFormatException
     {
        if (text.endsWith("ms"))
        {
           return Long.valueOf(text.substring(0, text.length() - 2));
        }
        else if (text.endsWith("s"))
        {
           return Long.valueOf(text.substring(0, text.length() - 1)) * 1000L;
        }
        else if (text.endsWith("m"))
        {
           return Long.valueOf(text.substring(0, text.length() - 1)) * 60000L; // 1000 * 60
        }
        else if (text.endsWith("h"))
        {
           return Long.valueOf(text.substring(0, text.length() - 1)) * 3600000L; // 1000 * 60 * 60
        }
        else if (text.endsWith("d"))
        {
           return Long.valueOf(text.substring(0, text.length() - 1)) * 86400000L; // 1000 * 60 * 60 * 24
        }
        else if (text.endsWith("w"))
        {
           return Long.valueOf(text.substring(0, text.length() - 1)) * 604800000L; // 1000 * 60 * 60 * 24
           // * 7
        }
        else
        { // seconds by default
           return Long.valueOf(text) * 1000L;
        }
     }
docs: Parse given text as formated time and return a time in milliseconds. <br> <br>Formats
  supported: <br>milliseconds - ms <br>seconds - without sufix <br>minutes - m <br>hours - h
  <br>days - d <br>weeks - w
  
  @param text
  - String
  @return time in milliseconds
  @throws NumberFormatException