public class DateUtils {
public static Integer timeStampToSeconds(String date)
{
String a="0:00:00.004420";
String[] split = date.split("\\.");
Integer s=0;
if (split.length>=2)
{
String[] strings = split[0].split(":");
if (strings.length == 3) {
s = Integer.valueOf(strings[0]) * 3600 + Integer.valueOf(strings[1]) * 60 + Integer.valueOf(strings[2]) * 100 / 100;
} else if (strings.length == 2) {
s = Integer.valueOf(strings[0]) * 60 + Integer.valueOf(strings[1]) * 100 / 100;
}
Double aDouble = Double.valueOf(s + "." + split[1]);
aDouble=Math.ceil(aDouble);
System.out.println(Double.valueOf(aDouble));
s=aDouble.intValue();
}
return s;
}
}
|