Click to Rate and Give Feedback
MSDN
MSDN Library
.NET Development
.NET Framework 3.5
System Namespace
DateTime Structure
 DateTime Members
Members FilterMembers Filter
Frameworks FilterFrameworks Filter
This page is specific to
Microsoft Visual Studio 2008/.NET Framework 3.5

Other versions are also available for the following:
.NET Framework Class Library
DateTime Members

Updated: November 2007

Represents an instant in time, typically expressed as a date and time of day.

The DateTime type exposes the following members.

  NameDescription
DateTimeOverloaded. Initializes a new instance of the DateTime structure.
Top
  NameDescription
Add Adds the value of the specified TimeSpan to the value of this instance.
AddDays Adds the specified number of days to the value of this instance.
AddHours Adds the specified number of hours to the value of this instance.
AddMilliseconds Adds the specified number of milliseconds to the value of this instance.
AddMinutes Adds the specified number of minutes to the value of this instance.
AddMonths Adds the specified number of months to the value of this instance.
AddSeconds Adds the specified number of seconds to the value of this instance.
AddTicks Adds the specified number of ticks to the value of this instance.
AddYears Adds the specified number of years to the value of this instance.
Compare 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.
CompareToOverloaded. Compares the value of this instance to a specified DateTime value and indicates whether this instance is earlier than, the same as, or later than the specified DateTime value.
DaysInMonth Returns the number of days in the specified month and year.
EqualsOverloaded. Returns a value indicating whether two DateTime objects, or a DateTime instance and another object or DateTime are equal.
Finalize Allows an Object to attempt to free resources and perform other cleanup operations before the Object is reclaimed by garbage collection. (Inherited from Object.)
FromBinary Deserializes a 64-bit binary value and recreates an original serialized DateTime object.
FromFileTime Converts the specified Windows file time to an equivalent local time.
FromFileTimeUtc Converts the specified Windows file time to an equivalent UTC time.
FromOADate Returns a DateTime equivalent to the specified OLE Automation Date.
GetDateTimeFormatsOverloaded. Converts the value of this instance to all the string representations supported by the standard DateTime format specifiers.
GetHashCode Returns the hash code for this instance. (Overrides ValueType..::.GetHashCode()()().)
GetType Gets the Type of the current instance. (Inherited from Object.)
GetTypeCode Returns the TypeCode for value type DateTime.
IsDaylightSavingTime Indicates whether this instance of DateTime is within the Daylight Saving Time range for the current time zone.
IsLeapYear Returns an indication whether the specified year is a leap year.
MemberwiseClone Creates a shallow copy of the current Object. (Inherited from Object.)
ParseOverloaded. Converts the specified string representation of a date and time to its DateTime equivalent.
ParseExactOverloaded. Converts the specified string representation of a date and time to its DateTime equivalent. The format of the string representation must match a specified format exactly or an exception is thrown.
SpecifyKind 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.
SubtractOverloaded. Subtracts the specified time or duration from this instance.
ToBinary Serializes the current DateTime object to a 64-bit binary value that subsequently can be used to recreate the DateTime object.
ToFileTime Converts the value of the current DateTime object to a Windows file time.
ToFileTimeUtc Converts the value of the current DateTime object to a Windows file time.
ToLocalTime Converts the value of the current DateTime object to local time.
ToLongDateString Converts the value of the current DateTime object to its equivalent long date string representation.
ToLongTimeString Converts the value of the current DateTime object to its equivalent long time string representation.
ToOADate Converts the value of this instance to the equivalent OLE Automation date.
ToShortDateString Converts the value of the current DateTime object to its equivalent short date string representation.
ToShortTimeString Converts the value of the current DateTime object to its equivalent short time string representation.
ToStringOverloaded. Converts the value of the current DateTime object to its equivalent string representation.
ToUniversalTime Converts the value of the current DateTime object to Coordinated Universal Time (UTC).
TryParseOverloaded. Converts the specified string representation of a date and time to its DateTime equivalent and returns a value that indicates whether the conversion succeeded.
TryParseExactOverloaded. Converts the specified string representation of a date and time to its DateTime equivalent. The format of the string representation must match a specified format exactly. The method returns a value that indicates whether the conversion succeeded.
Top
  NameDescription
Addition Adds a specified time interval to a specified date and time, yielding a new date and time.
Equality Determines whether two specified instances of DateTime are equal.
GreaterThan Determines whether one specified DateTime is greater than another specified DateTime.
GreaterThanOrEqual Determines whether one specified DateTime is greater than or equal to another specified DateTime.
Inequality Determines whether two specified instances of DateTime are not equal.
LessThan Determines whether one specified DateTime is less than another specified DateTime.
LessThanOrEqual Determines whether one specified DateTime is less than or equal to another specified DateTime.
SubtractionOverloaded. Subtracts a specified DateTime or TimeSpan from a specified DateTime.
Top
  NameDescription
MaxValue Represents the largest possible value of DateTime. This field is read-only.
MinValue Represents the smallest possible value of DateTime. This field is read-only.
Top
  NameDescription
Date Gets the date component of this instance.
Day Gets the day of the month represented by this instance.
DayOfWeek Gets the day of the week represented by this instance.
DayOfYear Gets the day of the year represented by this instance.
Hour Gets the hour component of the date represented by this instance.
Kind Gets a value that indicates whether the time represented by this instance is based on local time, Coordinated Universal Time (UTC), or neither.
Millisecond Gets the milliseconds component of the date represented by this instance.
Minute Gets the minute component of the date represented by this instance.
Month Gets the month component of the date represented by this instance.
Now Gets a DateTime object that is set to the current date and time on this computer, expressed as the local time.
Second Gets the seconds component of the date represented by this instance.
Ticks Gets the number of ticks that represent the date and time of this instance.
TimeOfDay Gets the time of day for this instance.
Today Gets the current date.
UtcNow Gets a DateTime object that is set to the current date and time on this computer, expressed as the Coordinated Universal Time (UTC).
Year Gets the year component of the date represented by this instance.
Top
  NameDescription
ISerializable..::.GetObjectData Populates a SerializationInfo object with the data needed to serialize the current DateTime object.
IConvertible..::.ToBooleanInfrastructure. This conversion is not supported. Attempting to use this method throws an InvalidCastException.
IConvertible..::.ToByteInfrastructure. This conversion is not supported. Attempting to use this method throws an InvalidCastException.
IConvertible..::.ToCharInfrastructure. This conversion is not supported. Attempting to use this method throws an InvalidCastException.
IConvertible.