Java SQL Time Format formatTimeToFloat(Time inputTime)

Here you can find the source of formatTimeToFloat(Time inputTime)

Description

Method used in constructing the appointment scheduling py script input.

License

Apache License

Parameter

Parameter Description
inputTime a parameter

Declaration

public static String formatTimeToFloat(Time inputTime) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import org.joda.time.DateTime;
import java.sql.Time;

public class Main {
    /**/*from ww w  . j  a va 2  s . c  o m*/
     * Method used in constructing the appointment scheduling py script input.
     * This method converts the given time in to the corresponding decimal equivalent of floating point representation.
     * Ex.  6:30 = 6.5
     *        6:45 = 6.75
     * @param inputTime
     * @return
     */
    public static String formatTimeToFloat(Time inputTime) {
        DateTime jodaTime = new DateTime(inputTime);
        int secsTime = jodaTime.getSecondOfDay();
        long beforeRound = Math.round((secsTime / 60.0d / 60.0d) * 10);
        float result = beforeRound / 10;
        return String.valueOf(result);
    }
}

Related

  1. formatDefaultValue(Object o)
  2. formatExceptionForToolsWithLimitedCharacterSet(String exceptionLabel)
  3. formatTime(Date date)
  4. formatTime(final Time time)
  5. formatTime(Time time, String format)
  6. formatToDateStr(long millis)