com.teraspaces.qwframework
Class DateTime

java.lang.Object
  extended by com.teraspaces.qwframework.DateTime
All Implemented Interfaces:
Comparable<DateTime>

public final class DateTime
extends Object
implements Comparable<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

MIN_VALUE

public static final DateTime MIN_VALUE
The Constant MIN_VALUE.


MAX_VALUE

public static final DateTime MAX_VALUE
The Constant MAX_VALUE.

Constructor Detail

DateTime

public DateTime(long ticks)
Instantiates a new date time to a specified number of ticks.

The Kind property is initialized to Unspecified.

Parameters:
ticks - the ticks

DateTime

public 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. .

Parameters:
ticks - the ticks
kind - the kind

DateTime

public DateTime(int year,
                int month,
                int day)
Instantiates a new date time.

Parameters:
year - the year
month - the month
day - the day

DateTime

public DateTime(int year,
                int month,
                int day,
                int hour,
                int minute,
                int second)
Instantiates a new date time.

Parameters:
year - the year
month - the month
day - the day
hour - the hour
minute - the minute
second - the second

DateTime

public DateTime(int year,
                int month,
                int day,
                int hour,
                int minute,
                int second,
                DateTimeKind kind)
Instantiates a new date time.

Parameters:
year - the year
month - the month
day - the day
hour - the hour
minute - the minute
second - the second
kind - the kind

DateTime

public DateTime(int year,
                int month,
                int day,
                int hour,
                int minute,
                int second,
                int millisecond)
Instantiates a new date time.

Parameters:
year - the year
month - the month
day - the day
hour - the hour
minute - the minute
second - the second
millisecond - the millisecond

DateTime

public DateTime(int year,
                int month,
                int day,
                int hour,
                int minute,
                int second,
                int millisecond,
                DateTimeKind kind)
Instantiates a new date time.

Parameters:
year - the year
month - the month
day - the day
hour - the hour
minute - the minute
second - the second
millisecond - the millisecond
kind - the kind
Method Detail

createBinary

public static long createBinary(int year,
                                int month,
                                int day)
Creates the binary representation of a DateTime.

This method is provided for performance reason, because Java doesn't have value types, use this method can avoid memory allocation.

Parameters:
year - the year
month - the month
day - the day
Returns:
the long integer that represents the specified DateTime
See Also:
toBinary(), fromBinary(long)

createBinary

public 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.

This method is provided for performance reason, because Java doesn't have value types, use this method can avoid memory allocation.

Parameters:
year - the year
month - the month
day - the day
hour - the hour
minute - the minute
second - the second
millisecond - the millisecond
kind - the kind
Returns:
the long integer that represents the specified DateTime
See Also:
toBinary(), fromBinary(long)

isLeapYear

public static boolean isLeapYear(int year)
Checks if is leap year.

Parameters:
year - the year
Returns:
true, if is leap year

addTicks

public DateTime addTicks(long value)
Adds the specified number of ticks to the value of this instance.

Parameters:
value - a number of 100-nanosecond ticks. The value parameter can be positive or negative
Returns:
a DateTime whose value is the sum of the date and time represented by this instance and the time represented by value

add

public DateTime add(TimeSpan value)
adds the value of the specified TimeSpan to the value of this instance

Parameters:
value - a TimeSpan object that represents a positive or negative time interval
Returns:
a DateTime whose value is the sum of the date and time represented by this instance and the time interval represented by value

addDays

public DateTime addDays(double value)
Adds the specified number of days to the value of this instance.

Parameters:
value - a number of whole and fractional days. The value parameter can be negative or positive
Returns:
a DateTime whose value is the sum of the date and time represented by this instance and the number of days represented by value

addHours

public DateTime addHours(double value)
Adds the specified number of hours to the value of this instance.

Parameters:
value - a number of whole and fractional hours. The value parameter can be negative or positive
Returns:
a DateTime whose value is the sum of the date and time represented by this instance and the number of hours represented by value

addMilliseconds

public DateTime addMilliseconds(double value)
Adds the specified number of milliseconds to the value of this instance.

Parameters:
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
Returns:
a DateTime whose value is the sum of the date and time represented by this instance and the number of milliseconds represented by value

addMinutes

public DateTime addMinutes(double value)
Adds the specified number of minutes to the value of this instance.

Parameters:
value - a number of whole and fractional minutes. The value parameter can be negative or positive
Returns:
a DateTime whose value is the sum of the date and time represented by this instance and the number of minutes represented by value

addMonths

public DateTime addMonths(int months)
Adds the specified number of months to the value of this instance.

Parameters:
months - a number of months. The months parameter can be negative or positive
Returns:
a DateTime whose value is the sum of the date and time represented by this instance and months

addSeconds

public DateTime addSeconds(double value)
Adds the specified number of seconds to the value of this instance.

Parameters:
value - a number of whole and fractional seconds. The value parameter can be negative or positive
Returns:
a DateTime whose value is the sum of the date and time represented by this instance and the number of seconds represented by value

addYears

public DateTime addYears(int value)
Adds the specified number of years to the value of this instance.

Parameters:
value - a number of years. The value parameter can be negative or positive
Returns:
a DateTime whose value is the sum of the date and time represented by this instance and the number of years represented by value

compare

public 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.

Parameters:
t1 - the first DateTime
t2 - the second DateTime
Returns:
a signed number indicating the relative values of t1 and t2

compare

public 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.

Parameters:
binary1 - the binary of the first DateTime
binary2 - the binary of the second DateTime
Returns:
a signed number indicating the relative values of t1 and t2

compareTo

public int compareTo(DateTime value)
Specified by:
compareTo in interface Comparable<DateTime>

compareTo

public 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.

Parameters:
binary - the binary of the DateTime to compare to
Returns:
a signed number indicating the relative values of t1 and t2

daysInMonth

public static int daysInMonth(int year,
                              int month)
Returns the number of days in the specified month and year.

Parameters:
year - the year
month - the month (a number ranging from 1 to 12)
Returns:
the number of days in month for the specified year

equals

public boolean equals(Object value)
Overrides:
equals in class Object

equals

public static boolean equals(DateTime t1,
                             DateTime t2)
Returns a value indicating whether two instances of DateTime are equal.

Parameters:
t1 - the first DateTime instance
t2 - the second DateTime instance
Returns:
true if the two DateTime values are equal; otherwise, false

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(DateTime value)
Returns a value indicating whether this instance is equal to the specified DateTime instance.

Parameters:
value - the value
Returns:
true if the two DateTime values are equal; otherwise, false

getDay

public int getDay()
Gets the day of the month represented by this instance.

Returns:
the day component, expressed as a value between 1 and 31

getDay

public static int getDay(long binary)
Gets the day of the month represented by the specified binary representation of a DateTime instance.

Parameters:
binary - the binary representation of a DateTime
Returns:
the day component, expressed as a value between 1 and 31

getDate

public DateTime getDate()
Gets the date component of this instance.

Returns:
a new DateTime with the same date as this instance, and the time value set to 12:00:00 midnight (00:00:00)

getDate

public static long getDate(long binary)
Gets the date component of the specified binary representation of a DateTime instance.

Parameters:
binary - the binary representation of a DateTime
Returns:
a binary DateTime with the same date as the specified instance, and the time value set to 12:00:00 midnight (00:00:00)

getDayOfWeek

public DayOfWeek getDayOfWeek()
Gets the day of the week represented by this instance.

Returns:
a DayOfWeek enumerated constant that indicates the day of the week of this DateTime value

getDayOfWeek

public static DayOfWeek getDayOfWeek(long binary)
Gets the day of the week represented by the specified binary representation of a DateTime instance.

Parameters:
binary - the binary representation of a DateTime
Returns:
a DayOfWeek enumerated constant that indicates the day of the week of the DateTime value

getDayOfYear

public int getDayOfYear()
Gets the day of the year represented by this instance.

Returns:
the day of the year, expressed as a value between 1 and 366

getDayOfYear

public static int getDayOfYear(long binary)
Gets the day of the year represented by the specified binary representation of a DateTime instance.

Parameters:
binary - the binary representation of a DateTime
Returns:
the day of the year, expressed as a value between 1 and 366

getHour

public int getHour()
Gets the hour component of the date represented by this instance.

Returns:
the hour component, expressed as a value between 0 and 23

getHour

public static int getHour(long binary)
Gets the hour component of the date represented by the specified binary representation of a DateTime instance.

Parameters:
binary - the binary representation of a DateTime
Returns:
the hour component, expressed as a value between 0 and 23

getKind

public 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.

Returns:
one of the DateTimeKind values. The default is Unspecified

getKind

public 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.

Parameters:
binary - the binary representation of a DateTime
Returns:
one of the DateTimeKind values. The default is Unspecified

getMinute

public int getMinute()
Gets the minute component of the date represented by this instance.

Returns:
the minute component, expressed as a value between 0 and 59

getMinute

public static int getMinute(long binary)
Gets the minute component of the date represented by the specified binary DateTime instance.

Parameters:
binary - the binary representation of a DateTime
Returns:
the minute component, expressed as a value between 0 and 59

getMonth

public int getMonth()
Gets the month component of the date represented by this instance.

Returns:
the month component, expressed as a value between 1 and 12

getMonth

public static int getMonth(long binary)
Gets the month component of the date represented by the specified binary DateTime instance.

Parameters:
binary - the binary representation of a DateTime
Returns:
the month component, expressed as a value between 1 and 12

getSecond

public int getSecond()
Gets the seconds component of the date represented by this instance.

Returns:
the seconds, between 0 and 59

getSecond

public static int getSecond(long binary)
Gets the seconds component of the date represented by specified binary DateTime instance.

Parameters:
binary - the binary representation of a DateTime
Returns:
the seconds, between 0 and 59

getMillisecond

public int getMillisecond()
Gets the milliseconds component of the date represented by this instance.

Returns:
the milliseconds component, expressed as a value between 0 and 999

getMillisecond

public static int getMillisecond(long binary)
Gets the milliseconds component of the date represented by specified binary DateTime instance.

Parameters:
binary - the binary representation of a DateTime
Returns:
the milliseconds component, expressed as a value between 0 and 999

getTicks

public long getTicks()
Gets the number of ticks that represent the date and time of this instance.

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.

Returns:
number of ticks that represent the date and time of this instance

getTicks

public static long getTicks(long binary)
Gets the number of ticks that represent the date and time of date represented by specified binary DateTime instance.

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.

Parameters:
binary - the binary representation of a DateTime
Returns:
number of ticks that represent the date and time of this instance

getTimeOfDay

public TimeSpan getTimeOfDay()
Gets the time of day for this instance.

Returns:
a TimeSpan that represents the fraction of the day that has elapsed since midnight

getTimeOfDay

public static long getTimeOfDay(long binary)
Gets the time of day for date represented by specified binary DateTime instance.

Parameters:
binary - the binary representation of a DateTime
Returns:
a binary representation of TimeSpan that represents the fraction of the day that has elapsed since midnight

getToday

public static DateTime getToday()
Gets the current date.

Returns:
a DateTime set to today's date, with the time component set to 00:00:00

getTodayAsBinary

public static long getTodayAsBinary()
Gets the today as binary.

Returns:
a binary (as a long integer) DateTime set to today's date, with the time component set to 00:00:00

getYear

public int getYear()
Gets the year component of the date represented by this instance.

Returns:
the year, between 1 and 9999

getYear

public static int getYear(long binary)
Gets the year component of the date represented by specified binary DateTime instance.

Parameters:
binary - the binary representation of a DateTime
Returns:
the year, between 1 and 9999

getNow

public static DateTime getNow()
Gets a DateTime object that is set to the current date and time on this computer, expressed as the local time.

Returns:
a DateTime whose value is the current local date and time

getNowAsBinary

public static long getNowAsBinary()
Gets a binary DateTime that is set to the current date and time on this computer, expressed as the local time.

Returns:
a binary DateTime whose value is the current local date and time

getUtcNow

public 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).

Returns:
a DateTime whose value is the current UTC date and time

getUtcNowAsBinary

public 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).

Returns:
a binary DateTime whose value is the current UTC date and time

toLocalTime

public DateTime toLocalTime()
Converts the value of the current DateTime object to local time.

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.

Returns:
a DateTime object whose Kind property is Local, and whose value is the local time equivalent to the value of the current DateTime object, or MaxValue if the converted value is too large to be represented by a DateTime object, or MinValue if the converted value is too small to be represented as a DateTime object

toUniversalTime

public DateTime toUniversalTime()
Converts the value of the current DateTime object to Coordinated Universal Time (UTC).

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.

Returns:
a DateTime object whose Kind property is Utc, and whose value is the UTC equivalent to the value of the current DateTime object, or MaxValue if the converted value is too large to be represented by a DateTime object, or MinValue if the converted value is too small to be represented by a DateTime object

toJavaDate

public Date toJavaDate()
Converts the value of the current DateTime object to a Java date.

Returns:
the Java Date

fromJavaDate

public static DateTime fromJavaDate(Date date)
Converts a Java Date into an instance of DateTime.

Parameters:
date - an instance of Java Date
Returns:
an instance of DateTime

getDaysInMonth

public static int getDaysInMonth(int year,
                                 int month)
Returns the number of days in the specified month and year.

Parameters:
year - the year
month - the month (a number ranging from 1 to 12)
Returns:
the number of days in month for the specified year

fromBinary

public static DateTime fromBinary(long dateData)
Deserializes a 64-bit binary value and recreates an original serialized DateTime object.

Parameters:
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
Returns:
the a DateTime object that is equivalent to the DateTime object that was serialized by the toBinary() method

fromFileTime

public static DateTime fromFileTime(long fileTime)
Converts the specified Windows file time to an equivalent local time.

Parameters:
fileTime - a Windows file time expressed in ticks
Returns:
a DateTime object that represents a local time equivalent to the date and time represented by the fileTime parameter

fromFileTimeUtc

public static DateTime fromFileTimeUtc(long fileTime)
Converts the specified Windows file time to an equivalent UTC time.

Parameters:
fileTime - a Windows file time expressed in ticks
Returns:
a DateTime object that represents a UTC time equivalent to the date and time represented by the fileTime parameter

isDaylightSavingTime

public boolean isDaylightSavingTime()
Indicates whether this instance of DateTime is within the Daylight Saving Time range for the current time zone.

Returns:
true if Kind is Local or Unspecified and the value of this instance of DateTime is within the Daylight Saving Time range for the current time zone. false if Kind is Utc

specifyKind

public 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.

Parameters:
value - the value
kind - the kind
Returns:
a new DateTime object consisting of the same time represented by the value parameter and the DateTimeKind value specified by the kind parameter

toBinary

public long toBinary()
Serializes the current DateTime object to a 64-bit binary value that subsequently can be used to recreate the DateTime object.

Returns:
a 64-bit signed integer that encodes the Kind and Ticks properties

toString

public String toString()
Overrides:
toString in class Object

valueOf

public static DateTime valueOf(String s)
Converts the specified string representation of a date and time to its DateTime equivalent.

Parameters:
s - a string containing a date and time to convert
Returns:
a DateTime equivalent to the date and time contained in s

parse

public static DateTime parse(String s)
Converts the specified string representation of a date and time to its DateTime equivalent.

Parameters:
s - a string containing a date and time to convert
Returns:
a DateTime equivalent to the date and time contained in s

subtract

public TimeSpan subtract(DateTime value)
Subtracts the specified time or duration from this instance.

Parameters:
value - the value
Returns:
a TimeSpan interval equal to the date and time represented by this instance minus the date and time represented by value

subtract

public DateTime subtract(TimeSpan value)
Subtracts the specified time or duration from this instance.

Parameters:
value - the value
Returns:
a DateTime equal to the date and time represented by this instance minus the time interval represented by value