Package jmri.util

Class DateUtil

java.lang.Object
jmri.util.DateUtil

public class DateUtil extends Object
Common utility methods for working with Calendar and Date objects.
  • Method Details

    • calFromJulianDate

      public static GregorianCalendar calFromJulianDate(long julianDay)
      Return a GregorianCalendar representation of the given julian date. For reference, see: http://aa.usno.navy.mil/faq/docs/JD_Formula.php
      Parameters:
      julianDay - number of days since January 1,4713BC.
      Returns:
      GregorianCalendar representation of julianDay
    • julianDayFromCalendar

      public static long julianDayFromCalendar(GregorianCalendar cal)
      Return a julian date representation of the given GregorianCalendar date. for reference, see: http://aa.usno.navy.mil/faq/docs/JD_Formula.php
      Parameters:
      cal - the GregorianCalendar to convert.
      Returns:
      julianDate representation of the date represented by cal.
    • userDurationFromSeconds

      public static String userDurationFromSeconds(int seconds)
      For a given number of seconds, format to a more human readable form. Negative durations are prepended by the minus symbol. For durations less than 24hrs, the day integer is omitted.
      Parameters:
      seconds - the number of seconds
      Returns:
      string representation of duration in D hh:mm:ss form.