Class Time

java.lang.Object
com.graphhopper.jsprit.core.util.Time

public class Time extends Object
  • Constructor Details

    • Time

      public Time()
  • Method Details

    • parseSecondsToTime

      public static String parseSecondsToTime(double seconds)
      Parses seconds to this time format: hh:mm:ss {AM|PM}
      Parameters:
      seconds - seconds
      Returns:
      time string
    • parseTimeToSeconds

      public static double parseTimeToSeconds(String timeString)
      Parse time to seconds.

      If you add PM or AM to timeString, it considers english-time, otherwise not.

      timeString can be 6AM, 06AM, 6 am, 6:01AM, 6:1 pM, 6:12:1 pm, 6:12:01 am, 06:12:01 Pm etc. - but not more precise than seconds.

      example: 12 AM returns 12*3600. sec 6:30 AM --> 6*3600. + 30*60. 0:30:20 AM --> 30*3600. + 20. 6:00 PM --> 6*3600. + 12.*3600. 6:00:12 --> 6*3600. + 12.

      Returns:
      seconds