|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectbiweekly.util.DateTimeComponents
public final class DateTimeComponents
Contains the raw components of a date-time value.
Examples:
//July 22, 2013 at 17:25 DateTimeComponents components = new DateTimeComponents(2013, 07, 22, 17, 25, 0, false); //parsing a date string (accepts basic and extended formats) DateTimeComponents components = DateTimeComponents.parse("20130722T172500"); //converting to date string DateTimeComponents components = new DateTimeComponents(2013, 07, 22, 17, 25, 0, false); String str = components.toString(true); //"2013-07-22T17:25:00" //converting to a Date object DateTimeComponents components = new DateTimeComponents(2013, 07, 22, 17, 25, 0, false); Date date = components.toDate();
Constructor Summary | |
---|---|
DateTimeComponents(DateTimeComponents original,
Integer year,
Integer month,
Integer date,
Integer hour,
Integer minute,
Integer second,
Boolean utc)
Copies an existing DateTimeComponents object. |
|
DateTimeComponents(int year,
int month,
int date,
int hour,
int minute,
int second,
boolean utc)
Creates a new set of date-time components. |
Method Summary | |
---|---|
boolean |
equals(Object obj)
|
int |
getDate()
Gets the date component |
int |
getHour()
Gets the hour component |
int |
getMinute()
Gets the minute component. |
int |
getMonth()
Gets the month component. |
int |
getSecond()
Gets the second component. |
int |
getYear()
Gets the year component. |
int |
hashCode()
|
boolean |
isUtc()
Gets whether the time is in UTC or not |
static DateTimeComponents |
parse(String dateString)
Parses the components out of a date-time string. |
Date |
toDate()
Converts the date-time components to a Date object. |
String |
toString()
Converts the date-time components to a string using "basic" format. |
String |
toString(boolean extended)
Converts the date-time components to a string. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public DateTimeComponents(DateTimeComponents original, Integer year, Integer month, Integer date, Integer hour, Integer minute, Integer second, Boolean utc)
original
- the object to copy fromyear
- the new year value or null not to changemonth
- the new month value or null not to changedate
- the new date value or null not to changehour
- the new hour value or null not to changeminute
- the new minute value or null not to changesecond
- the new second value or null not to changeutc
- true if the time is in UTC, false if not, or null not to
changepublic DateTimeComponents(int year, int month, int date, int hour, int minute, int second, boolean utc)
year
- the year (e.g. "2013")month
- the month (e.g. "1" for January)date
- the date of the month (e.g. "15")hour
- the hour (e.g. "13")minute
- the minutesecond
- the secondutc
- true if the time is in UTC, false if notMethod Detail |
---|
public static DateTimeComponents parse(String dateString)
dateString
- the date-time string (basic and extended formats
supported, e.g. "20130331T020000" or "2013-03-31T02:00:00")
IllegalArgumentException
- if the date string cannot be parsedpublic int getYear()
public int getMonth()
public int getDate()
public int getHour()
public int getMinute()
public int getSecond()
public boolean isUtc()
public String toString()
toString
in class Object
public String toString(boolean extended)
extended
- true to use extended format, false to use basic
public Date toDate()
Date
object.
public int hashCode()
hashCode
in class Object
public boolean equals(Object obj)
equals
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |