gov.nasa.gsfc.drl.rtstps.core.output.hdf5
Class FilenameTimefieldFormat
java.lang.Object
gov.nasa.gsfc.drl.rtstps.core.output.hdf5.FilenameTimefieldFormat
public class FilenameTimefieldFormat
- extends java.lang.Object
Enforce certain time field formats for the the RDR filename. Time zone is UTC. Uses SimpleDateFormat
.
Method Summary |
java.lang.String |
format(java.util.Date timeDate)
Format the given Date into proper FilenameTimeField |
private static java.text.SimpleDateFormat |
initializeTime1()
|
private static java.text.SimpleDateFormat |
initializeTime2()
|
java.util.Date |
parse(java.lang.String timeStr)
Parse the given string according to the FilenameTimefieldFormat and return it as a Date |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
dfTime
private static java.text.SimpleDateFormat dfTime
mfTime
private static java.text.SimpleDateFormat mfTime
fieldId
private StartStopFieldId fieldId
FilenameTimefieldFormat
public FilenameTimefieldFormat(StartStopFieldId fieldId)
- Construct a new FileTimefieldFormat using the {link@ StartStopFieldId} as an input. Time zone is UTC.
- Parameters:
fieldId
- a StartStopFieldId which is used in the official name
initializeTime1
private static java.text.SimpleDateFormat initializeTime1()
initializeTime2
private static java.text.SimpleDateFormat initializeTime2()
format
public java.lang.String format(java.util.Date timeDate)
- Format the given Date into proper FilenameTimeField
- Parameters:
timeDate
- the time/date of interest
- Returns:
- a String that enforces the format
parse
public java.util.Date parse(java.lang.String timeStr)
throws java.text.ParseException
- Parse the given string according to the FilenameTimefieldFormat and return it as a Date
- Parameters:
timeStr
- the string containing the time and date
- Returns:
- a Date with the time and date from the string encoded in it
- Throws:
java.text.ParseException
- throws ParseException if the string cannot be parsed according to the format