Skip to content

Commit

Permalink
add Utils.convertTimeStringToInt
Browse files Browse the repository at this point in the history
  • Loading branch information
vitriolix committed Apr 3, 2013
1 parent 51f1f62 commit d0ffc93
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions app/src/info/guardianproject/mrapp/Utils.java
@@ -1,5 +1,8 @@
package info.guardianproject.mrapp;

import java.text.ParseException;
import java.text.SimpleDateFormat;

import org.holoeverywhere.app.Activity;
import org.holoeverywhere.widget.Toast;

Expand All @@ -13,4 +16,19 @@ public void run() {
}
});
}

/**
*
* @param timeString in 00:00:00.000 format (hour:min:second.ms)
* @return time in ms
*/
public static int convertTimeStringToInt(String timeString) {
int duration = 0;
try {
duration = (int) (new SimpleDateFormat("hh:mm:ss.SS").parse(timeString)).getTime();
} catch (ParseException e) {
e.printStackTrace();
}
return duration;
}
}

0 comments on commit d0ffc93

Please sign in to comment.