Package org.faktorips.runtime.internal
Class DateTime
- java.lang.Object
-
- org.faktorips.runtime.internal.DateTime
-
- All Implemented Interfaces:
java.io.Serializable,java.lang.Comparable<DateTime>
public class DateTime extends java.lang.Object implements java.lang.Comparable<DateTime>, java.io.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
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description intcompareTo(DateTime other)static DateTimecreateDateOnly(java.util.GregorianCalendar calendar)Creates a new date time object with the year, month and day information from the GregorianCalendar.booleanequals(java.lang.Object o)intgetDay()intgetHour()intgetMinute()intgetMonth()intgetSecond()intgetYear()inthashCode()static DateTimeparseIso(java.lang.String s)Parses the given String s to a DateTime object.java.util.DatetoDate(java.util.TimeZone zone)java.util.GregorianCalendartoGregorianCalendar(java.util.TimeZone zone)java.lang.StringtoIsoFormat()java.lang.StringtoString()longtoTimeInMillisecs(java.util.TimeZone zone)
-
-
-
Method Detail
-
parseIso
public static final DateTime parseIso(java.lang.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. Returnsnullif s isnullor an empty String.- Throws:
java.lang.IllegalArgumentException- if s has a wrong format and can't be parsed.
-
createDateOnly
public static final DateTime createDateOnly(java.util.GregorianCalendar calendar)
Creates a new date time object with the year, month and day information from the GregorianCalendar. Time information is initialized with 0. Returnsnullif 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(java.util.TimeZone zone)
-
toDate
public java.util.Date toDate(java.util.TimeZone zone)
-
toGregorianCalendar
public java.util.GregorianCalendar toGregorianCalendar(java.util.TimeZone zone)
-
toIsoFormat
public java.lang.String toIsoFormat()
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equalsin classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-