public class DCDate extends Object
Dates in the DSpace database are held in the ISO 8601 format. They are always stored in UTC, converting to and from the current time zone. In practice only dates with a time component need to be converted.
YYYY-MM-DDThh:mm:ss
There are four levels of granularity, depending on how much date information is available: year, month, day, time.
Examples: 1994-05-03T15:30:24,1995-10-04,
2001-10,1975
| Constructor and Description |
|---|
DCDate(Date date)
Construct a date object from a Java
Date object. |
DCDate(int yyyy,
int mm,
int dd,
int hh,
int mn,
int ss)
Construct a date object from a bunch of component parts.
|
DCDate(String fromDC)
Construct a date from a Dublin Core value
|
| Modifier and Type | Method and Description |
|---|---|
String |
displayDate(boolean showTime,
boolean isLocalTime,
Locale locale)
Format a human-readable version of the DCDate, with optional time.
|
String |
displayLocalDate(boolean showTime,
Locale locale) |
String |
displayUTCDate(boolean showTime,
Locale locale) |
static DCDate |
getCurrent()
Get a date representing the current instant in time.
|
int |
getDay()
Get the day, adjusting for current time zone.
|
int |
getDayUTC()
Get the day in UTC.
|
int |
getHour()
Get the hour, adjusting for current time zone.
|
int |
getHourUTC()
Get the hour in UTC.
|
int |
getMinute()
Get the minute, adjusting for current time zone.
|
int |
getMinuteUTC()
Get the minute in UTC.
|
int |
getMonth()
Get the month, adjusting for current time zone.
|
static String |
getMonthName(int m,
Locale locale)
Get a month's name for a month between 1 and 12.
|
int |
getMonthUTC()
Get the month in UTC.
|
int |
getSecond()
Get the second, adjusting for current time zone.
|
int |
getSecondUTC()
Get the second in UTC.
|
int |
getYear()
Get the year, adjusting for current time zone.
|
int |
getYearUTC()
Get the year in UTC.
|
Date |
toDate()
Get the date as a Java Date object.
|
String |
toString()
Get the date as a string to put back in the Dublin Core.
|
public DCDate(Date date)
Date object.date - the Java Date object.public DCDate(int yyyy,
int mm,
int dd,
int hh,
int mn,
int ss)
yyyy - the yearmm - the monthdd - the dayhh - the hoursmn - the minutesss - the secondspublic DCDate(String fromDC)
fromDC - the date string, in ISO 8601 (no timezone, always use UTC)public int getYear()
public int getMonth()
public int getDay()
public int getHour()
public int getMinute()
public int getSecond()
public int getYearUTC()
public int getMonthUTC()
public int getDayUTC()
public int getHourUTC()
public int getMinuteUTC()
public int getSecondUTC()
public String toString()
public Date toDate()
public String displayDate(boolean showTime, boolean isLocalTime, Locale locale)
showTime - if true, display the time with the dateisLocalTime - if true, adjust for local time zone, otherwise UTClocale - locale of the userpublic static DCDate getCurrent()
Copyright © 2016 DuraSpace. All Rights Reserved.