I'm trying to convert a time string to milliseconds using the code below. Because I will use the time as countdown timer.
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.
String timeDuration = "10:00"; //for example only
SimpleDateFormat sdf = new SimpleDateFormat("mm:ss");
Date time = sdf.parse(timeDuration);
long millis = time.getTime(); //The output must be 600000
I'm getting the wrong "millis" using this code.
I'm using Android Studio.