Java Utililty Methods Time Convert to

List of utility methods to do Time Convert to

Description

The list of methods to do Time Convert to are organized into topic(s).

Method

DoubletimeToDouble(Object value)
time To Double
Double ret = new Double(0.);
if (value != null && value instanceof String) {
    try {
        String duration = (String) value;
        int length = duration.length();
        double hours = 0;
        double mins = 0;
        double millisecs = 0.;
...
doubletimeToDriveDistanceDeadReckoning(double distance, double robotMaxSpeed, double targetSpeed)
Return the time to drive a given distance.
double distancePerSecond = robotMaxSpeed * targetSpeed;
return distance / distancePerSecond;
StringtimeToExactString(double d)
time To Exact String
if (d == NO_DATA_D) {
    return "No Data";
} else {
    int minutes = ((int) d) / 60;
    int seconds = ((int) d) - (minutes * 60);
    int hundreds = (int) ((d - ((int) d)) * 100.0);
    String result = String.valueOf(minutes) + ":";
    if (seconds < 10) {
...
floattimeToFloat(String aTimeDuration)
time To Float
float oreLavorate = 0f;
if (aTimeDuration != null && aTimeDuration.length() > 0) {
    String[] membri = aTimeDuration.split(":");
    if (membri.length > 1) {
        oreLavorate = Float.parseFloat(membri[0]);
        oreLavorate = oreLavorate + (Float.parseFloat(membri[1]) / 60);
    } else {
        oreLavorate = Float.parseFloat(membri[0]);
...
inttimeToFromNow(long time)
time To From Now
long maxAgeMillis = time - System.currentTimeMillis();
return (int) (maxAgeMillis / 1000) + (maxAgeMillis % 1000 != 0 ? 1 : 0);
inttimeToIndex(String twentyFourHourTime)
time To Index
String[] timeArray = twentyFourHourTime.split(":");
if (Integer.parseInt(timeArray[1]) == 30) {
    return 2 * Integer.parseInt(timeArray[0]) + 1;
} else {
    return 2 * Integer.parseInt(timeArray[0]);
inttimeToInt(final String time)
Parses time values such as 09:16:45 from gtfs to an integer values represented in seconds.
String[] times = time.split(":");
int hours = Integer.parseInt((String) times[0]);
int minutes = Integer.parseInt((String) times[1]);
int seconds = Integer.parseInt((String) times[2]);
return (seconds + minutes * 60 + hours * 3600);
StringtimeToJgo(long milliSeconds)
time To Jgo
return milliSeconds / 1000 + "";
longtimeToLong(String inputStr)
time To Long
String newStr = inputStr.replaceAll(" ", ""); 
long time = 0;
int weekIndex2;
int dayIndex2;
int hourIndex2;
int minuteIndex2;
int secondIndex2;
if (newStr.indexOf('w') != -1) {
...
longtimeToMs(int day, int hour, int min, int sec)
Convert time to millisecond.
return ((long) CONSTANT_1000) * (((day * CONSTANT_24 + hour) * CONSTANT_60 + min) * CONSTANT_60 + sec);