|
||||||||||
| PREV CLASS NEXT CLASS | All Classes | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.teraspaces.qwframework.DateTime
public final class DateTime
The Java implementation of .Net DateTime.
| Field Summary | |
|---|---|
static DateTime |
MAX_VALUE
The Constant MAX_VALUE. |
static DateTime |
MIN_VALUE
The Constant MIN_VALUE. |
| Constructor Summary | |
|---|---|
DateTime(int year,
int month,
int day)
Instantiates a new date time. |
|
DateTime(int year,
int month,
int day,
int hour,
int minute,
int second)
Instantiates a new date time. |
|
DateTime(int year,
int month,
int day,
int hour,
int minute,
int second,
DateTimeKind kind)
Instantiates a new date time. |
|
DateTime(int year,
int month,
int day,
int hour,
int minute,
int second,
int millisecond)
Instantiates a new date time. |
|
DateTime(int year,
int month,
int day,
int hour,
int minute,
int second,
int millisecond,
DateTimeKind kind)
Instantiates a new date time. |
|
DateTime(long ticks)
Instantiates a new date time to a specified number of ticks. |
|
DateTime(long ticks,
DateTimeKind kind)
Instantiates a new date time to a specified number of ticks and to Coordinated Universal Time (UTC) or local time. |
|
| Method Summary | |
|---|---|
DateTime |
add(TimeSpan value)
adds the value of the specified TimeSpan to the value of this instance |
DateTime |
addDays(double value)
Adds the specified number of days to the value of this instance. |
DateTime |
addHours(double value)
Adds the specified number of hours to the value of this instance. |
DateTime |
addMilliseconds(double value)
Adds the specified number of milliseconds to the value of this instance. |
DateTime |
addMinutes(double value)
Adds the specified number of minutes to the value of this instance. |
DateTime |
addMonths(int months)
Adds the specified number of months to the value of this instance. |
DateTime |
addSeconds(double value)
Adds the specified number of seconds to the value of this instance. |
DateTime |
addTicks(long value)
Adds the specified number of ticks to the value of this instance. |
DateTime |
addYears(int value)
Adds the specified number of years to the value of this instance. |
static int |
compare(DateTime t1,
DateTime t2)
Compares two instances of DateTime and returns an integer that indicates whether the first instance is earlier than, the same as, or later than the second instance. |
static int |
compare(long binary1,
long binary2)
Compares two instances of DateTime and returns an integer that indicates whether the first instance is earlier than, the same as, or later than the second instance. |
int |
compareTo(DateTime value)
|
int |
compareTo(long binary)
Compares the value of this instance to a specified DateTime value and returns an integer that indicates whether this instance is earlier than, the same as, or later than the specified DateTime value. |
static long |
createBinary(int year,
int month,
int day)
Creates the binary representation of a DateTime. |
static long |
createBinary(int year,
int month,
int day,
int hour,
int minute,
int second,
int millisecond,
DateTimeKind kind)
Creates the binary representation of a DateTime. |
static int |
daysInMonth(int year,
int month)
Returns the number of days in the specified month and year. |
boolean |
equals(DateTime value)
Returns a value indicating whether this instance is equal to the specified DateTime instance. |
static boolean |
equals(DateTime t1,
DateTime t2)
Returns a value indicating whether two instances of DateTime are equal. |
boolean |
equals(Object value)
|
static DateTime |
fromBinary(long dateData)
Deserializes a 64-bit binary value and recreates an original serialized DateTime object. |
static DateTime |
fromFileTime(long fileTime)
Converts the specified Windows file time to an equivalent local time. |
static DateTime |
fromFileTimeUtc(long fileTime)
Converts the specified Windows file time to an equivalent UTC time. |
static DateTime |
fromJavaDate(Date date)
Converts a Java Date into an instance of DateTime. |
DateTime |
getDate()
Gets the date component of this instance. |
static long |
getDate(long binary)
Gets the date component of the specified binary representation of a DateTime instance. |
int |
getDay()
Gets the day of the month represented by this instance. |
static int |
getDay(long binary)
Gets the day of the month represented by the specified binary representation of a DateTime instance. |
DayOfWeek |
getDayOfWeek()
Gets the day of the week represented by this instance. |
static DayOfWeek |
getDayOfWeek(long binary)
Gets the day of the week represented by the specified binary representation of a DateTime instance. |
int |
getDayOfYear()
Gets the day of the year represented by this instance. |
static int |
getDayOfYear(long binary)
Gets the day of the year represented by the specified binary representation of a DateTime instance. |
static int |
getDaysInMonth(int year,
int month)
Returns the number of days in the specified month and year. |
int |
getHour()
Gets the hour component of the date represented by this instance. |
static int |
getHour(long binary)
Gets the hour component of the date represented by the specified binary representation of a DateTime instance. |
DateTimeKind |
getKind()
Gets a value that indicates whether the time represented by this instance is based on local time, Coordinated Universal Time (UTC), or neither. |
static DateTimeKind |
getKind(long binary)
Gets a value that indicates whether the time represented by the specified binary DateTime instance is based on local time, Coordinated Universal Time (UTC), or neither. |
int |
getMillisecond()
Gets the milliseconds component of the date represented by this instance. |
static int |
getMillisecond(long binary)
Gets the milliseconds component of the date represented by specified binary DateTime instance. |
int |
getMinute()
Gets the minute component of the date represented by this instance. |
static int |
getMinute(long binary)
Gets the minute component of the date represented by the specified binary DateTime instance. |
int |
getMonth()
Gets the month component of the date represented by this instance. |
static int |
getMonth(long binary)
Gets the month component of the date represented by the specified binary DateTime instance. |
static DateTime |
getNow()
Gets a DateTime object that is set to the current date and time on this computer, expressed as the local time. |
static long |
getNowAsBinary()
Gets a binary DateTime that is set to the current date and time on this computer, expressed as the local time. |
int |
getSecond()
Gets the seconds component of the date represented by this instance. |
static int |
getSecond(long binary)
Gets the seconds component of the date represented by specified binary DateTime instance. |
long |
getTicks()
Gets the number of ticks that represent the date and time of this instance. |
static long |
getTicks(long binary)
Gets the number of ticks that represent the date and time of date represented by specified binary DateTime instance. |
TimeSpan |
getTimeOfDay()
Gets the time of day for this instance. |
static long |
getTimeOfDay(long binary)
Gets the time of day for date represented by specified binary DateTime instance. |
static DateTime |
getToday()
Gets the current date. |
static long |
getTodayAsBinary()
Gets the today as binary. |
static DateTime |
getUtcNow()
Gets a DateTime object that is set to the current date and time on this computer, expressed as the Coordinated Universal Time (UTC). |
static long |
getUtcNowAsBinary()
Gets a binary representation of a DateTime that is set to the current date and time on this computer, expressed as the Coordinated Universal Time (UTC). |
int |
getYear()
Gets the year component of the date represented by this instance. |
static int |
getYear(long binary)
Gets the year component of the date represented by specified binary DateTime instance. |
int |
hashCode()
|
boolean |
isDaylightSavingTime()
Indicates whether this instance of DateTime is within the Daylight Saving Time range for the current time zone. |
static boolean |
isLeapYear(int year)
Checks if is leap year. |
static DateTime |
parse(String s)
Converts the specified string representation of a date and time to its DateTime equivalent. |
static DateTime |
specifyKind(DateTime value,
DateTimeKind kind)
Creates a new DateTime object that represents the same time as the specified DateTime, but is designated in either local time, Coordinated Universal Time (UTC), or neither, as indicated by the specified DateTimeKind value. |
TimeSpan |
subtract(DateTime value)
Subtracts the specified time or duration from this instance. |
DateTime |
subtract(TimeSpan value)
Subtracts the specified time or duration from this instance. |
long |
toBinary()
Serializes the current DateTime object to a 64-bit binary value that subsequently can be used to recreate the DateTime object. |
Date |
toJavaDate()
Converts the value of the current DateTime object to a Java date. |
DateTime |
toLocalTime()
Converts the value of the current DateTime object to local time. |
String |
toString()
|
DateTime |
toUniversalTime()
Converts the value of the current DateTime object to Coordinated Universal Time (UTC). |
static DateTime |
valueOf(String s)
Converts the specified string representation of a date and time to its DateTime equivalent. |
| Methods inherited from class java.lang.Object |
|---|
getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final DateTime MIN_VALUE
public static final DateTime MAX_VALUE
| Constructor Detail |
|---|
public DateTime(long ticks)
The Kind property is initialized to Unspecified.
ticks - the ticks
public DateTime(long ticks,
DateTimeKind kind)
ticks - the tickskind - the kind
public DateTime(int year,
int month,
int day)
year - the yearmonth - the monthday - the day
public DateTime(int year,
int month,
int day,
int hour,
int minute,
int second)
year - the yearmonth - the monthday - the dayhour - the hourminute - the minutesecond - the second
public DateTime(int year,
int month,
int day,
int hour,
int minute,
int second,
DateTimeKind kind)
year - the yearmonth - the monthday - the dayhour - the hourminute - the minutesecond - the secondkind - the kind
public DateTime(int year,
int month,
int day,
int hour,
int minute,
int second,
int millisecond)
year - the yearmonth - the monthday - the dayhour - the hourminute - the minutesecond - the secondmillisecond - the millisecond
public DateTime(int year,
int month,
int day,
int hour,
int minute,
int second,
int millisecond,
DateTimeKind kind)
year - the yearmonth - the monthday - the dayhour - the hourminute - the minutesecond - the secondmillisecond - the millisecondkind - the kind| Method Detail |
|---|
public static long createBinary(int year,
int month,
int day)
This method is provided for performance reason, because Java doesn't have value types, use this method can avoid memory allocation.
year - the yearmonth - the monthday - the day
toBinary(),
fromBinary(long)
public static long createBinary(int year,
int month,
int day,
int hour,
int minute,
int second,
int millisecond,
DateTimeKind kind)
This method is provided for performance reason, because Java doesn't have value types, use this method can avoid memory allocation.
year - the yearmonth - the monthday - the dayhour - the hourminute - the minutesecond - the secondmillisecond - the millisecondkind - the kind
toBinary(),
fromBinary(long)public static boolean isLeapYear(int year)
year - the year
public DateTime addTicks(long value)
value - a number of 100-nanosecond ticks. The value parameter can be positive or negative
public DateTime add(TimeSpan value)
value - a TimeSpan object that represents a positive or negative time interval
public DateTime addDays(double value)
value - a number of whole and fractional days. The value parameter can be negative or positive
public DateTime addHours(double value)
value - a number of whole and fractional hours. The value parameter can be negative or positive
public DateTime addMilliseconds(double value)
value - a number of whole and fractional milliseconds. The value parameter can be negative or positive. Note that this value is rounded to the nearest integer
public DateTime addMinutes(double value)
value - a number of whole and fractional minutes. The value parameter can be negative or positive
public DateTime addMonths(int months)
months - a number of months. The months parameter can be negative or positive
public DateTime addSeconds(double value)
value - a number of whole and fractional seconds. The value parameter can be negative or positive
public DateTime addYears(int value)
value - a number of years. The value parameter can be negative or positive
public static int compare(DateTime t1,
DateTime t2)
t1 - the first DateTimet2 - the second DateTime
public static int compare(long binary1,
long binary2)
binary1 - the binary of the first DateTimebinary2 - the binary of the second DateTime
public int compareTo(DateTime value)
compareTo in interface Comparable<DateTime>public int compareTo(long binary)
binary - the binary of the DateTime to compare to
public static int daysInMonth(int year,
int month)
year - the yearmonth - the month (a number ranging from 1 to 12)
public boolean equals(Object value)
equals in class Object
public static boolean equals(DateTime t1,
DateTime t2)
t1 - the first DateTime instancet2 - the second DateTime instance
public int hashCode()
hashCode in class Objectpublic boolean equals(DateTime value)
value - the value
public int getDay()
public static int getDay(long binary)
binary - the binary representation of a DateTime
public DateTime getDate()
public static long getDate(long binary)
binary - the binary representation of a DateTime
public DayOfWeek getDayOfWeek()
DayOfWeek enumerated constant that indicates the day of the week of this DateTime valuepublic static DayOfWeek getDayOfWeek(long binary)
binary - the binary representation of a DateTime
DayOfWeek enumerated constant that indicates the day of the week of the DateTime valuepublic int getDayOfYear()
public static int getDayOfYear(long binary)
binary - the binary representation of a DateTime
public int getHour()
public static int getHour(long binary)
binary - the binary representation of a DateTime
public DateTimeKind getKind()
DateTimeKind values. The default is Unspecifiedpublic static DateTimeKind getKind(long binary)
binary - the binary representation of a DateTime
DateTimeKind values. The default is Unspecifiedpublic int getMinute()
public static int getMinute(long binary)
binary - the binary representation of a DateTime
public int getMonth()
public static int getMonth(long binary)
binary - the binary representation of a DateTime
public int getSecond()
public static int getSecond(long binary)
binary - the binary representation of a DateTime
public int getMillisecond()
public static int getMillisecond(long binary)
binary - the binary representation of a DateTime
public long getTicks()
a single tick represents one hundred nanoseconds or one ten-millionth of a second.
The value of this property represents the number of 100-nanosecond intervals that have
elapsed since 12:00:00 midnight, January 1, 0001, which represents MIN_VALUE.
public static long getTicks(long binary)
a single tick represents one hundred nanoseconds or one ten-millionth of a second.
The value of this property represents the number of 100-nanosecond intervals that have
elapsed since 12:00:00 midnight, January 1, 0001, which represents MIN_VALUE.
binary - the binary representation of a DateTime
public TimeSpan getTimeOfDay()
TimeSpan that represents the fraction of the day that has elapsed since midnightpublic static long getTimeOfDay(long binary)
binary - the binary representation of a DateTime
TimeSpan that represents the fraction of the day that has elapsed since midnightpublic static DateTime getToday()
public static long getTodayAsBinary()
public int getYear()
public static int getYear(long binary)
binary - the binary representation of a DateTime
public static DateTime getNow()
public static long getNowAsBinary()
public static DateTime getUtcNow()
public static long getUtcNowAsBinary()
public DateTime toLocalTime()
The local time is equal to the Coordinated Universal Time (UTC) time plus the UTC offset. The conversion also takes into account the daylight saving time rule that applies to the time represented by the current DateTime object.
public DateTime toUniversalTime()
The Coordinated Universal Time (UTC) is equal to the local time minus the UTC offset. The conversion also takes into account the daylight saving time rule that applies to the time represented by the current DateTime object.
public Date toJavaDate()
public static DateTime fromJavaDate(Date date)
Date into an instance of DateTime.
date - an instance of Java Date
public static int getDaysInMonth(int year,
int month)
year - the yearmonth - the month (a number ranging from 1 to 12)
public static DateTime fromBinary(long dateData)
dateData - a 64-bit signed integer that encodes the Kind property in a 2-bit field and the Ticks property in a 62-bit field
toBinary() methodpublic static DateTime fromFileTime(long fileTime)
fileTime - a Windows file time expressed in ticks
public static DateTime fromFileTimeUtc(long fileTime)
fileTime - a Windows file time expressed in ticks
public boolean isDaylightSavingTime()
public static DateTime specifyKind(DateTime value,
DateTimeKind kind)
value - the valuekind - the kind
public long toBinary()
public String toString()
toString in class Objectpublic static DateTime valueOf(String s)
s - a string containing a date and time to convert
public static DateTime parse(String s)
s - a string containing a date and time to convert
public TimeSpan subtract(DateTime value)
value - the value
public DateTime subtract(TimeSpan value)
value - the value
|
||||||||||
| PREV CLASS NEXT CLASS | All Classes | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||