Package jmri.util
Class DateUtil
java.lang.Object
jmri.util.DateUtil
Common utility methods for working with Calendar and Date objects.
-
Method Summary
Modifier and TypeMethodDescriptionstatic GregorianCalendarcalFromJulianDate(long julianDay) Return a GregorianCalendar representation of the given julian date.static longReturn a julian date representation of the given GregorianCalendar date.static StringuserDurationFromSeconds(int seconds) For a given number of seconds, format to a more human readable form.
-
Method Details
-
calFromJulianDate
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:
GregorianCalendarrepresentation of julianDay
-
julianDayFromCalendar
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
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.
-