org.apache.oodt.commons.util
Class DateConvert

java.lang.Object
  extended by org.apache.oodt.commons.util.DateConvert

public class DateConvert
extends Object

The DateConvert class is intended to provide date/time conversion and parse routines. For a description of the syntax of the format strings see SimpleDateFormat.

Version:
$Revision: 1.1.1.1 $
Author:
S. Hardman

Constructor Summary
DateConvert()
          Constructor given no arguments.
 
Method Summary
static String dbmsFormat(Date inputDate)
          Format the given date and return the resulting string in a DBMS format.
static Date dbmsParse(String inputString)
          Parse the given date/time string in DBMS format and return the resulting Date object.
static String doyFormat(Date inputDate)
          Format the given date and return the resulting string in CCSDS ASCII Time Code B format.
static Date doyParse(String inputString)
          Parse the given date/time string in CCSDS ASCII Time Code B format and return the resulting Date object.
static long getMsecsInDay()
          Get the number of milliseconds in a day.
static long getMsecsInHour()
          Get the number of milliseconds in an hour.
static long getMsecsInMinute()
          Get the number of milliseconds in a minute.
static String isoFormat(Date inputDate)
          Format the given date and return the resulting string in ISO 8601 format.
static Date isoParse(String inputString)
          Parse the given date/time string in ISO 8601 format and return the resulting Date object.
static String tsFormat(Date inputDate)
          Format the given date and return the resulting string in a timestamp format.
static Date tsParse(String inputString)
          Parse the given date/time string in timestamp format and return the resulting Date object.
static String ymdFormat(Date inputDate)
          Format the given date and return the resulting string in a year-month-day format.
static Date ymdParse(String inputString)
          Parse the given date/time string in year-month-day format and return the resulting Date object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DateConvert

public DateConvert()
            throws IllegalStateException
Constructor given no arguments. This is a static-only class that may not be instantiated.

Throws:
IllegalStateException - If the class is instantiated.
Method Detail

isoFormat

public static String isoFormat(Date inputDate)
Format the given date and return the resulting string in ISO 8601 format. The format is as follows: "yyyy-MM-dd'T'HH:mm:ss.SSS[Z|[+|-]HH:mm]".

Parameters:
inputDate - The date to be converted into string format.
Returns:
The formatted date/time string.

isoParse

public static Date isoParse(String inputString)
                     throws ParseException
Parse the given date/time string in ISO 8601 format and return the resulting Date object. The format is as follows: "yyyy-MM-dd'T'HH:mm:ss.SSS[Z|[+|-]HH:mm]".

Parameters:
inputString - The string to be parsed.
Returns:
The resulting Date object.
Throws:
ParseException - If the string is null or does not match the date/time format.

doyFormat

public static String doyFormat(Date inputDate)
Format the given date and return the resulting string in CCSDS ASCII Time Code B format. The format is as follows: "yyyy-DDD'T'HH:mm:ss.SSS".

Parameters:
inputDate - The date to be converted into string format.
Returns:
The formatted date/time string.

doyParse

public static Date doyParse(String inputString)
                     throws ParseException
Parse the given date/time string in CCSDS ASCII Time Code B format and return the resulting Date object. The format is as follows: "yyyy-DDD'T'HH:mm:ss.SSS".

Parameters:
inputString - The string to be parsed.
Returns:
The resulting Date object.
Throws:
ParseException - If the string does not match the date/time format.

tsFormat

public static String tsFormat(Date inputDate)
Format the given date and return the resulting string in a timestamp format. The format is as follows: "yyyyMMddHHmmssSSS".

Parameters:
inputDate - The date to be converted into string format.
Returns:
The formatted date/time string.

tsParse

public static Date tsParse(String inputString)
                    throws ParseException
Parse the given date/time string in timestamp format and return the resulting Date object. The format is as follows: "yyyyMMddHHmmssSSS".

Parameters:
inputString - The string to be parsed.
Returns:
The resulting Date object.
Throws:
ParseException - If the string does not match the date/time format.

dbmsFormat

public static String dbmsFormat(Date inputDate)
Format the given date and return the resulting string in a DBMS format. The format is as follows: "dd-MMM-yyyy HH:mm:ss".

Parameters:
inputDate - The date to be converted into string format.
Returns:
The formatted date/time string.

dbmsParse

public static Date dbmsParse(String inputString)
                      throws ParseException
Parse the given date/time string in DBMS format and return the resulting Date object. The format is as follows: "dd-MMM-yyyy HH:mm:ss".

Parameters:
inputString - The string to be parsed.
Returns:
The resulting Date object.
Throws:
ParseException - If the string does not match the date/time format.

ymdFormat

public static String ymdFormat(Date inputDate)
Format the given date and return the resulting string in a year-month-day format. The format is as follows: "yyyy-MM-dd".

Parameters:
inputDate - The date to be converted into string format.
Returns:
The formatted date/time string.

ymdParse

public static Date ymdParse(String inputString)
                     throws ParseException
Parse the given date/time string in year-month-day format and return the resulting Date object. The format is as follows: "yyyy-MM-dd".

Parameters:
inputString - The string to be parsed.
Returns:
The resulting Date object.
Throws:
ParseException - If the string does not match the date/time format.

getMsecsInMinute

public static long getMsecsInMinute()
Get the number of milliseconds in a minute.

Returns:
The number of milliseconds in a minute.

getMsecsInHour

public static long getMsecsInHour()
Get the number of milliseconds in an hour.

Returns:
The number of milliseconds in an hour.

getMsecsInDay

public static long getMsecsInDay()
Get the number of milliseconds in a day.

Returns:
The number of milliseconds in a day.


Copyright © 1999-2013
Apache OODT. All Rights Reserved.