Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- *
- * @param strDate: "yyyy-MM-dd hh:mm:ss"
- * @return unixtime, it´s the unix timestamp in long integer.
- * 0, in case of error.
- */
- private long convertStringTotimestamp(String strDate){
- try{
- SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss z");
- Date parsedDate = dateFormat.parse(strDate);
- long unixTime = (long) parsedDate.getTime()/1000;
- return unixTime;
- }catch(Exception e){
- Print.logError((String)"Cannot convert Unit's UTC time to timestamp.");
- return 0;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement