org.faktorips.runtime.internal
Class DateTime
java.lang.Object
org.faktorips.runtime.internal.DateTime
- All Implemented Interfaces:
- Serializable, Comparable<DateTime>
public class DateTime
- extends Object
- implements Comparable<DateTime>, Serializable
Represents date and time information like 2006-01-01 10:00pm independent of the time zone. To
convert a date and time object to a point in time (represented in the Java class libraries by
Date and Calendar) a time zone has to be provided in the conversion method toDate().
- Author:
- Jan Ortmann
- See Also:
Date,
GregorianCalendar,
TimeZone,
Serialized Form
|
Constructor Summary |
DateTime(int year,
int month,
int day)
|
DateTime(int year,
int month,
int day,
int hour,
int minute,
int second)
|
DateTime
public DateTime(int year,
int month,
int day)
DateTime
public DateTime(int year,
int month,
int day,
int hour,
int minute,
int second)
parseIso
public static final DateTime parseIso(String s)
- Parses the given String s to a DateTime object. The string should have the ISO date format
(YYYY-MM-DD). Time information is initialized with 0. Returns
null if s if
null or an empty String.
- Throws:
IllegalArgumentException - if s has a wrong format and can't be parsed.
createDateOnly
public static final DateTime createDateOnly(GregorianCalendar calendar)
- Creates a new date time object with the year, month and day information from the
GregorianCalendar. Time information is initialized with 0. Returns
null if
calendar isnull.
getDay
public int getDay()
getMonth
public int getMonth()
getYear
public int getYear()
getHour
public int getHour()
getMinute
public int getMinute()
getSecond
public int getSecond()
toTimeInMillisecs
public long toTimeInMillisecs(TimeZone zone)
toDate
public Date toDate(TimeZone zone)
toGregorianCalendar
public GregorianCalendar toGregorianCalendar(TimeZone zone)
toIsoFormat
public String toIsoFormat()
hashCode
public int hashCode()
- Overrides:
hashCode in class Object
equals
public boolean equals(Object o)
- Overrides:
equals in class Object
toString
public String toString()
- Overrides:
toString in class Object
compareTo
public int compareTo(DateTime other)
- Specified by:
compareTo in interface Comparable<DateTime>
Copyright © 2015. All rights reserved.