System.DateTime: Method Members

The methods of System.DateTime are listed below. For a list of all members, see the DateTime list.

See Also: ValueType

Public Methods

Add(TimeSpan) : DateTime

Returns a new DateTime that adds the value of the specified TimeSpan to the value of this instance.

AddDays(Double) : DateTime

Returns a new DateTime that adds the specified number of days to the value of this instance.

AddHours(Double) : DateTime

Returns a new DateTime that adds the specified number of hours to the value of this instance.

AddMilliseconds(Double) : DateTime

Returns a new DateTime that adds the specified number of milliseconds to the value of this instance.

AddMinutes(Double) : DateTime

Returns a new DateTime that adds the specified number of minutes to the value of this instance.

AddMonths(Int32) : DateTime

Returns a new DateTime that adds the specified number of months to the value of this instance.

AddSeconds(Double) : DateTime

Returns a new DateTime that adds the specified number of seconds to the value of this instance.

AddTicks(Int64) : DateTime

Returns a new DateTime that adds the specified number of ticks to the value of this instance.

AddYears(Int32) : DateTime

Returns a new DateTime that adds the specified number of years to the value of this instance.

static
Compare(DateTime, DateTime) : Int32

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.

CompareTo(DateTime) : Int32

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.

CompareTo(Object) : Int32

Compares the value of this instance to a specified object that contains 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
DaysInMonth(Int32, Int32) : Int32

Returns the number of days in the specified month and year.

Equals(DateTime) : Boolean

Returns a value indicating whether the value of this instance is equal to the value of the specified DateTime instance.

override
Equals(Object) : Boolean

Returns a value indicating whether this instance is equal to a specified object.

static
Equals(DateTime, DateTime) : Boolean

Returns a value indicating whether two DateTime instances have the same date and time value.

static
FromBinary(Int64) : DateTime

Deserializes a 64-bit binary value and recreates an original serialized DateTime object.

static
FromFileTime(Int64) : DateTime

Converts the specified Windows file time to an equivalent local time.

static
FromFileTimeUtc(Int64) : DateTime

Converts the specified Windows file time to an equivalent UTC time.

static
FromOADate(Double) : DateTime

Returns a DateTime equivalent to the specified OLE Automation Date.

GetDateTimeFormats() : String[]

Converts the value of this instance to all the string representations supported by the standard date and time format specifiers.

GetDateTimeFormats(Char) : String[]

Converts the value of this instance to all the string representations supported by the specified standard date and time format specifier.

GetDateTimeFormats(IFormatProvider) : String[]

Converts the value of this instance to all the string representations supported by the standard date and time format specifiers and the specified culture-specific formatting information.

GetDateTimeFormats(Char, IFormatProvider) : String[]

Converts the value of this instance to all the string representations supported by the specified standard date and time format specifier and culture-specific formatting information.

override
GetHashCode() : Int32

Returns the hash code for this instance.

GetTypeCode() : TypeCode

Returns the TypeCode for value type DateTime.

IsDaylightSavingTime() : Boolean

Indicates whether this instance of DateTime is within the daylight saving time range for the current time zone.

static
IsLeapYear(Int32) : Boolean

Returns an indication whether the specified year is a leap year.

static
Parse(String) : DateTime

Converts the string representation of a date and time to its DateTime equivalent.

static
Parse(String, IFormatProvider) : DateTime

Converts the string representation of a date and time to its DateTime equivalent by using culture-specific format information.

static
Parse(String, IFormatProvider, DateTimeStyles) : DateTime

Converts the string representation of a date and time to its DateTime equivalent by using culture-specific format information and formatting style.

static
ParseExact(String, String, IFormatProvider) : DateTime

Converts the specified string representation of a date and time to its DateTime equivalent using the specified format and culture-specific format information. The format of the string representation must match the specified format exactly.

static
ParseExact(String, String, IFormatProvider, DateTimeStyles) : DateTime

Converts the specified string representation of a date and time to its DateTime equivalent using the specified format, culture-specific format information, and style. The format of the string representation must match the specified format exactly or an exception is thrown.

static
ParseExact(String, String[], IFormatProvider, DateTimeStyles) : DateTime

Converts the specified string representation of a date and time to its DateTime equivalent using the specified array of formats, culture-specific format information, and style. The format of the string representation must match at least one of the specified formats exactly or an exception is thrown.

static
SpecifyKind(DateTime, DateTimeKind) : DateTime

Creates a new DateTime object that has the same number of ticks as the specified DateTime, but is designated as either local time, Coordinated Universal Time (UTC), or neither, as indicated by the specified DateTimeKind value.

Subtract(DateTime) : TimeSpan

Subtracts the specified date and time from this instance.

Subtract(TimeSpan) : DateTime

Subtracts the specified duration from this instance.

ToBinary() : Int64

Serializes the current DateTime object to a 64-bit binary value that subsequently can be used to recreate the DateTime object.

ToFileTime() : Int64

Converts the value of the current DateTime object to a Windows file time.

ToFileTimeUtc() : Int64

Converts the value of the current DateTime object to a Windows file time.

ToLocalTime() : DateTime

Converts the value of the current DateTime object to local time.

ToLongDateString() : String

Converts the value of the current DateTime object to its equivalent long date string representation.

ToLongTimeString() : String

Converts the value of the current DateTime object to its equivalent long time string representation.

ToOADate() : Double

Converts the value of this instance to the equivalent OLE Automation date.

ToShortDateString() : String

Converts the value of the current DateTime object to its equivalent short date string representation.

ToShortTimeString() : String

Converts the value of the current DateTime object to its equivalent short time string representation.

override
ToString() : String

Converts the value of the current DateTime object to its equivalent string representation.

ToString(IFormatProvider) : String

Converts the value of the current DateTime object to its equivalent string representation using the specified culture-specific format information.

ToString(String) : String

Converts the value of the current DateTime object to its equivalent string representation using the specified format.

ToString(String, IFormatProvider) : String

Converts the value of the current DateTime object to its equivalent string representation using the specified format and culture-specific format information.

ToUniversalTime() : DateTime

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

static
TryParse(String, out DateTime) : Boolean
static
TryParse(String, IFormatProvider, DateTimeStyles, out DateTime) : Boolean
static
TryParseExact(String, String, IFormatProvider, DateTimeStyles, out DateTime) : Boolean
static
TryParseExact(String, String[], IFormatProvider, DateTimeStyles, out DateTime) : Boolean