Package nom.tam.fits

Class FitsDate

java.lang.Object
nom.tam.fits.FitsDate
All Implemented Interfaces:
Comparable<FitsDate>

public class FitsDate extends Object implements Comparable<FitsDate>
ISO timestamp support for FITS headers. Such timestamps are used with DATE style header keywords, such as DATE-OBS or DATE-END.
  • Constructor Details

    • FitsDate

      public FitsDate(String dStr) throws FitsException
      Convert a FITS date string to a Java Date object.
      Parameters:
      dStr - the FITS date
      Throws:
      FitsException - if dStr does not contain a valid FITS date.
  • Method Details

    • getFitsDateString

      public static String getFitsDateString()
      Returns the FITS date string for the current date and time.
      Returns:
      the current date in FITS date format
      See Also:
    • getFitsDateString

      public static String getFitsDateString(Date epoch)
      Returns the FITS date string for a specific date and time
      Parameters:
      epoch - The epoch to be converted to FITS format.
      Returns:
      a created FITS format date string Java Date object.
      See Also:
    • getFitsDateString

      public static String getFitsDateString(Date epoch, boolean timeOfDay)
      Returns the FITS date string, with or without the time component, for a specific date and time.
      Parameters:
      epoch - The epoch to be converted to FITS format.
      timeOfDay - Whether the time of day information shouldd be included
      Returns:
      a created FITS format date string. Note that the date is not rounded.
      See Also:
    • toDate

      public Date toDate()
      Get a Java Date object corresponding to this FITS date.
      Returns:
      The Java Date object.
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • compareTo

      public int compareTo(FitsDate fitsDate)
      Specified by:
      compareTo in interface Comparable<FitsDate>