|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.starteam.util.DateTime
public final class DateTime
An SDK implementation of Date and Time whose internal representation is in UTC It provides transformations and converters to java.util.Date and to/from Ticks, to support interoperability with Microsoft.NET System.DateTime This class does not support millisecond precision.
| Field Summary | |
|---|---|
static DateTime |
CURRENT_SERVER_TIME
A date value that can signal the server to use its current time rather than any specific time sent by the client. |
static double |
DATE_TIME_VALUE_NOT_SET
Constant used in some properties to indicate this value has not been set. |
static DateTime |
EARLIEST_SUPPORTED_TIME
A date value representing January 1, 1899 |
static DateTime |
MAX_VALUE
The largest DateTime this class can handle. |
static DateTime |
MIN_VALUE
The smallest DateTime this class can handle. |
static DateTime |
VALUE_NOT_SET
DateTime used in some properties to indicate this value has not been set. |
| Constructor Summary | |
|---|---|
DateTime()
Creates a new DateTime from the current time. |
|
DateTime(java.util.Date date)
Creates a new DateTime from a java.util.Date |
|
DateTime(double oletime)
Creates a new DateTime given a double which is an DateTime representing the number of days since midnight January 1, 1899. |
|
DateTime(int year,
int month,
int day)
Creates a new DateTime from the specified parts |
|
DateTime(int year,
int month,
int day,
int hour,
int minute,
int second)
Creates a new DateTime from the specified parts |
|
DateTime(long javatime)
Creates a new DateTime given a long value as would be returned from the Java Date class method getTime(). |
|
| Method Summary | |
|---|---|
static DateTime |
add(DateTime time,
TimeSpan delta)
returns a DateTime composed by adding elapsed time to a DateTime instance |
DateTime |
add(TimeSpan delta)
returns a DateTime composed by adding elapsed time to this DateTime instance |
int |
compareTo(DateTime date)
Returns: > 0 if this date is after the given date; 0 if this date is the same as the given date; < 0 if this date is before the given date. |
boolean |
equals(java.lang.Object obj)
Compare this DateTime with another one |
static DateTime |
fromJavaDate(java.util.Date date)
Creates an instance of a DateTime object from a java.util.Date object |
static DateTime |
fromJavaMsec(long msec)
Creates an instance of a DateTime object from a long value as would be returned from java.util.Date.getTime(). |
static double |
fromJavaMsecToOATime(long val)
A helper method that converts a long (java.util.Date.getTime()) to a double (DateTime.toOATime()) |
static long |
fromJavaMsecToTicks(long msec)
A helper method that converts a long (java.util.Date.getTime()) to a long .NET tick (System.DateTime.Ticks) |
static DateTime |
fromOATime(double time)
Creates an instance of a DateTime object from a double value as would be returned from DateTime.toOATime() |
static long |
fromOATimeToJavaMsec(double dbl)
A helper method that converts a double (DateTime.toOATime()) to a long (java.util.Date.getTime()) |
static long |
fromOATimeToTicks(double time)
A helper method that converts a double ((DateTime.toOATime.toOATime()) to a .NET tick (System.DateTime.Ticks) |
static DateTime |
fromTicks(long ticks)
Creates an instance of a DateTime object from a long value as would be returned from the .NET property System.DateTime.Ticks |
static long |
fromTicksToJavaMsec(long ticks)
A helper method that converts a long .NET tick (System.DateTime.Ticks) to a long (java.util.Date.getTime()) |
static TimeSpan |
getElapsedTime(DateTime before,
DateTime after)
returns the elapsed time between two DateTime instances |
DateTime |
getUTCNoon()
Returns a DateTime whose value is UTC noon of the current DateTime instance |
int |
hashCode()
returns a unique hash for this DateTime |
boolean |
isAfter(DateTime date)
Returns true if the given date is after this one in time |
boolean |
isBefore(DateTime date)
Returns true if the given date is before this one in time |
static DateTime |
now()
Returns a new DateTime from the current time. |
static DateTime |
subtract(DateTime time,
TimeSpan delta)
returns a DateTime composed by subtracting elapsed time from a DateTime instance |
DateTime |
subtract(TimeSpan delta)
returns a DateTime composed by subtracting elapsed time from this DateTime instance |
Date |
toDate()
return the Date part of this DateTime instance |
java.lang.String |
toISO8601String()
Returns an ISO8601 string representation of this time using GMT as the timezone. |
java.util.Date |
toJavaDate()
Returns an instance of a java.util.Date from this DateTime |
long |
toJavaMsec()
Returns the Java based long time for this DateTime value. |
java.lang.String |
toLocalString()
Simple display of the date using the default Locale and the DateFormat.LONG values for the date and time. |
java.lang.String |
toLocalString(int dateFormat,
int timeFormat)
returns a String representation of this DateTime instance formatted for the default locale |
double |
toOATime()
Returns the DateTime's double value for this date. |
java.lang.String |
toString()
Simple display of the date using the default Locale and the DateFormat.LONG values for the date and time. |
long |
toTicks()
Returns the .NET equivalent Ticks for this DateTime instance |
| Methods inherited from class java.lang.Object |
|---|
getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final DateTime EARLIEST_SUPPORTED_TIME
public static final DateTime CURRENT_SERVER_TIME
public static final double DATE_TIME_VALUE_NOT_SET
public static final DateTime VALUE_NOT_SET
public static final DateTime MIN_VALUE
public static final DateTime MAX_VALUE
| Constructor Detail |
|---|
public DateTime()
public DateTime(int year,
int month,
int day)
year - 1900 - 9999month - 0 - 11 (January == 0)day - 1 - 31
public DateTime(int year,
int month,
int day,
int hour,
int minute,
int second)
year - 1900 - 9999month - 0 - 11 (January == 0)day - 1 - 31hour - 0 - 23minute - 0 - 59second - 0 - 59public DateTime(double oletime)
oletime - the number of days since midnight January 1, 1899.public DateTime(long javatime)
javatime - - the value of java.util.Date.getTime()public DateTime(java.util.Date date)
date - - an instance of a java.util.Date object| Method Detail |
|---|
public static DateTime now()
public double toOATime()
public long toJavaMsec()
public long toTicks()
public java.util.Date toJavaDate()
public static DateTime fromJavaMsec(long msec)
msec - - a long value as would be returned from
java.util.Date.getTime()
public static DateTime fromJavaDate(java.util.Date date)
date - - a java.util.Date instance
public static DateTime fromOATime(double time)
time - - a double value as would be returned from DateTime.toOATime()
public static DateTime fromTicks(long ticks)
ticks - a long value as would be returned from the .NET property
System.DateTime.Ticks
public static long fromOATimeToJavaMsec(double dbl)
dbl - a double as would be returned by DateTime.toOATime()
public static long fromOATimeToTicks(double time)
time - - a double as would be returned by DateTime.toOATime()
public static double fromJavaMsecToOATime(long val)
val - - a long as would be returned by java.util.Date.getTime()
public static long fromJavaMsecToTicks(long msec)
msec - - a long as would be returned by java.util.Date.getTime()
public static long fromTicksToJavaMsec(long ticks)
ticks - - a long as would be returned by System.DateTime.Ticks
public DateTime getUTCNoon()
public java.lang.String toString()
toString in class java.lang.Objectpublic java.lang.String toLocalString()
public java.lang.String toLocalString(int dateFormat,
int timeFormat)
dateFormat - a date format descriptortimeFormat - a time formate descriptor
DateFormatpublic java.lang.String toISO8601String()
ISO8601public int hashCode()
hashCode in class java.lang.Objectpublic boolean equals(java.lang.Object obj)
equals in class java.lang.Objectobj - the DateTiem instance to compare it with
public static TimeSpan getElapsedTime(DateTime before,
DateTime after)
before - DateTimeafter - DateTime
public static DateTime add(DateTime time,
TimeSpan delta)
time - an existing DateTimedelta - the TimeSpan to add
public DateTime add(TimeSpan delta)
delta - the TimeSpan to add
public static DateTime subtract(DateTime time,
TimeSpan delta)
time - an existing DateTimedelta - the TimeSpan to subtract
public DateTime subtract(TimeSpan delta)
delta - TimeSpan
public Date toDate()
java.lang.IllegalArgumentException - if the conversion is not possiblepublic int compareTo(DateTime date)
date - - the Date instance to compare with this one
public boolean isBefore(DateTime date)
date - - the Date instance to compare with this one
public boolean isAfter(DateTime date)
date - - the Date instance to compare with this one
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||