title: How to convert String time to Long milliseconds in Java
body: <p>I'm trying to convert a time string to milliseconds using the code below. Because I will use the time as countdown timer.</p>
  <p>The problem is that the time is from database and it is on varchar type. I tried this code and it's not giving me the correct output.</p>
  <pre><code>String timeDuration = &quot;10:00&quot;; //for example only
  SimpleDateFormat sdf = new SimpleDateFormat(&quot;mm:ss&quot;);
  Date time = sdf.parse(timeDuration);
  long millis = time.getTime(); //The output must be 600000
  </code></pre>
  <p>I'm getting the wrong &quot;millis&quot; using this code.</p>
  <p>I'm using Android Studio.</p>