gov.nasa.gsfc.drl.rtstps.core.output.hdf5
Class TimeFormat

java.lang.Object
  extended by gov.nasa.gsfc.drl.rtstps.core.output.hdf5.TimeFormat

public class TimeFormat
extends java.lang.Object

Provides parse or format methods for certain time field attributes such as Granule's N_CreationTime field. In some cases the method loses the microseconds if dealing with Java Date as microseconds are not supported.


Constructor Summary
TimeFormat()
           
 
Method Summary
static java.util.Date createDateTime(java.lang.String dateStr, java.lang.String timeStr)
          Take values from string formated as yyyyMMdd and HHmmss.SSSuuuZ and creates a Date but loses the microseconds since Java does not support them in the Date.
static PDSDate createPDSDateTime(java.lang.String dateStr, java.lang.String timeStr)
          Take values from string formated as yyyyMMdd and HHmmss.SSSuuuZ and creates a PDSDate
static java.lang.StringBuffer formatDate(java.util.Date date)
          Return a StringBuffer of formatted DateTime yyyyMMdd.
static java.lang.StringBuffer formatDateTime(java.util.Date date)
          Return a StringBuffer of formatted DateTime yyyyMMddHHmmss.SSSuuuZ.
static java.lang.StringBuffer formatPDSDate(PDSDate date)
          Return a StringBuffer of formatted PDSDate yyyyMMdd.
static java.lang.StringBuffer formatPDSDateTime(PDSDate date)
          Return a StringBuffer of formatted PDSDateTime yyyyMMddHHmmss.SSSuuuZ.
static java.lang.StringBuffer formatPDSTime(PDSDate date)
          Return a StringBuffer of formatted PDSDateTime HHmmss.SSSuuuZ.
static java.lang.StringBuffer formatTime(java.util.Date date)
          Return a StringBuffer of formatted DateTime HHmmss.SSSuuuZ.
static java.util.Date parseDateTime(java.lang.String dateTime)
          Parse an input DateTime String in the format yyyyMMddHHmmss.SSSuuuZ and return a Date.
static PDSDate parsePDSDateTime(java.lang.String dateTime)
          Parse an input DateTime String in the format yyyyMMddHHmmss.SSSuuuZ and return a PDSDate.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TimeFormat

public TimeFormat()
Method Detail

parseDateTime

public static java.util.Date parseDateTime(java.lang.String dateTime)
                                    throws RtStpsException
Parse an input DateTime String in the format yyyyMMddHHmmss.SSSuuuZ and return a Date. The uuuZ is ignored by this method as microseconds are not supported by Java Data.

Returns:
a Date in UTC. Use DateFormat to view it in UTC
Throws:
throws - RtStpsException on an input format error
RtStpsException

parsePDSDateTime

public static PDSDate parsePDSDateTime(java.lang.String dateTime)
                                throws RtStpsException
Parse an input DateTime String in the format yyyyMMddHHmmss.SSSuuuZ and return a PDSDate.

Returns:
a PDSDate
Throws:
throws - RtStpsException on an input format error
RtStpsException

formatDateTime

public static java.lang.StringBuffer formatDateTime(java.util.Date date)
Return a StringBuffer of formatted DateTime yyyyMMddHHmmss.SSSuuuZ. Microseconds are currently appended as "000" as Date does not support it.

Parameters:
date - the input date and time
Returns:
a formatted StringBuffer

formatDate

public static java.lang.StringBuffer formatDate(java.util.Date date)
Return a StringBuffer of formatted DateTime yyyyMMdd.

Parameters:
date - the input Date
Returns:
a formatted StringBuffer

formatTime

public static java.lang.StringBuffer formatTime(java.util.Date date)
Return a StringBuffer of formatted DateTime HHmmss.SSSuuuZ. Microseconds are currently appended as "000" as Date does not support it.

Parameters:
date - the input date and time
Returns:
a formatted StringBuffer

formatPDSDateTime

public static java.lang.StringBuffer formatPDSDateTime(PDSDate date)
Return a StringBuffer of formatted PDSDateTime yyyyMMddHHmmss.SSSuuuZ.

Parameters:
date - the input date and time
Returns:
a formatted StringBuffer

formatPDSDate

public static java.lang.StringBuffer formatPDSDate(PDSDate date)
Return a StringBuffer of formatted PDSDate yyyyMMdd.

Parameters:
date - the input date and time
Returns:
a formatted StringBuffer

formatPDSTime

public static java.lang.StringBuffer formatPDSTime(PDSDate date)
Return a StringBuffer of formatted PDSDateTime HHmmss.SSSuuuZ.

Parameters:
date - the input date and time
Returns:
a formatted StringBuffer

createDateTime

public static java.util.Date createDateTime(java.lang.String dateStr,
                                            java.lang.String timeStr)
                                     throws RtStpsException
Take values from string formated as yyyyMMdd and HHmmss.SSSuuuZ and creates a Date but loses the microseconds since Java does not support them in the Date.

Parameters:
dateStr - A string in the format of: yyyyMMdd
timeStr - A string in the format of: HHmmss.SSSuuuZ
Returns:
the Date constructed from the string values of each field except for microseconds
Throws:
RtStpsException

createPDSDateTime

public static PDSDate createPDSDateTime(java.lang.String dateStr,
                                        java.lang.String timeStr)
                                 throws RtStpsException
Take values from string formated as yyyyMMdd and HHmmss.SSSuuuZ and creates a PDSDate

Parameters:
dateStr - A string in the format of: yyyyMMdd
timeStr - A string in the format of: HHmmss.SSSuuuZ
Returns:
the PDSDate constructed from the string values of each field
Throws:
RtStpsException