dk.statsbiblioteket.doms.summa.oai
Class OAIDateFormat
java.lang.Object
dk.statsbiblioteket.doms.summa.oai.OAIDateFormat
public class OAIDateFormat
- extends java.lang.Object
Create dates in ISO-8601 UTC format compliant with the OAI speccification.
This class resembles a stripped down java.text.DateFormat except that the
parse(java.lang.String)
method is able to handle date string in two formats namely
"2006-12-24" and "2006-12-24T17:45:55Z".
- Version:
- summaStorage-0.2 - build date 01/29/2007 11:57
Field Summary |
private java.text.SimpleDateFormat |
longFormat
|
private java.text.SimpleDateFormat |
shortFormat
|
Method Summary |
java.lang.String |
currentDate()
|
java.lang.String |
format(java.util.Date date)
|
java.util.Date |
parse(java.lang.String date)
Parse a date string in one of the formats "2006-12-24" and
"2006-12-24T17:45:55Z". |
long |
timeStamp(java.lang.String date)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
shortFormat
private java.text.SimpleDateFormat shortFormat
longFormat
private java.text.SimpleDateFormat longFormat
OAIDateFormat
public OAIDateFormat()
currentDate
public java.lang.String currentDate()
timeStamp
public long timeStamp(java.lang.String date)
throws java.text.ParseException
- Throws:
java.text.ParseException
format
public java.lang.String format(java.util.Date date)
parse
public java.util.Date parse(java.lang.String date)
throws java.text.ParseException
- Parse a date string in one of the formats "2006-12-24" and
"2006-12-24T17:45:55Z".
- Parameters:
date
- A string in one of the allowed OAI date formats
- Returns:
- a
Date
object corresponding to the input string
- Throws:
java.text.ParseException
- If the date string doesn't match any of the allowed formats