Here you can find the source of getMilliSeconds(String input)
public static long getMilliSeconds(String input)
//package com.java2s; //License from project: Open Source License public class Main { public static long getMilliSeconds(String input) { if (input.toLowerCase().endsWith("h")) { return Long.parseLong(input.replace("h", "")) * 60 * 60 * 1000; } else if (input.toLowerCase().endsWith("m")) { return Long.parseLong(input.replace("m", "")) * 60 * 1000; } else if (input.toLowerCase().endsWith("d")) { return Long.parseLong(input.replace("d", "")) * 24 * 60 * 60 * 1000; } else if (input.toLowerCase().endsWith("w")) { return Long.parseLong(input.replace("w", "")) * 7 * 24 * 60 * 60 * 1000; } else if (input.toLowerCase().endsWith("s")) { return Long.parseLong(input.replace("s", "")) * 1000; } else {/* w ww . j a v a2 s .c o m*/ return Long.parseLong(input); } } }