Click or drag to resize
DateTime Structure
Represents an instant in time, typically expressed as a date and time of day.

Namespace: System
Assembly: mscorlib (in mscorlib.dll) Version: 4.0.0.0
Syntax
C#
[SerializableAttribute]
public struct DateTime : IComparable, IFormattable, 
	IConvertible, ISerializable, IComparable<DateTime>, IEquatable<DateTime>

The DateTime type exposes the following members.

Methods
  NameDescription
Public methodAddDays
Returns a new DateTime that adds the specified number of days to the value of this instance.
Public methodEquals(DateTime)
Returns a value indicating whether the value of this instance is equal to the value of the specified DateTime instance.
Public methodEquals(Object)
Returns a value indicating whether this instance is equal to a specified object.
(Overrides ValueTypeEquals(Object).)
Public methodStatic memberEquals(DateTime, DateTime)
Returns a value indicating whether two DateTime instances have the same date and time value.
Public methodGetHashCode
Returns the hash code for this instance.
(Overrides ValueTypeGetHashCode.)
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Public methodStatic memberParse(String)
Converts the specified string representation of a date and time to its DateTime equivalent.
Public methodStatic memberParse(String, IFormatProvider)
Converts the specified string representation of a date and time to its DateTime equivalent using the specified culture-specific format information.
Public methodStatic memberParse(String, IFormatProvider, DateTimeStyles)
Converts the specified string representation of a date and time to its DateTime equivalent using the specified culture-specific format information and formatting style.
Public methodToString
Converts the value of the current DateTime object to its equivalent string representation.
(Overrides ValueTypeToString.)
Public methodToString(IFormatProvider)
Converts the value of the current DateTime object to its equivalent string representation using the specified culture-specific format information.
Public methodToString(String)
Converts the value of the current DateTime object to its equivalent string representation using the specified format.
Public methodToString(String, IFormatProvider)
Converts the value of the current DateTime object to its equivalent string representation using the specified format and culture-specific format information.
Public methodToUniversalTime
Converts the value of the current DateTime object to Coordinated Universal Time (UTC).
Public methodStatic memberTryParse(String, DateTime)
Converts the specified string representation of a date and time to its DateTime equivalent and returns a value that indicates whether the conversion succeeded.
Public methodStatic memberTryParse(String, IFormatProvider, DateTimeStyles, DateTime)
Converts the specified string representation of a date and time to its DateTime equivalent using the specified culture-specific format information and formatting style, and returns a value that indicates whether the conversion succeeded.
Top
Operators
  NameDescription
Public operatorStatic memberEquality
Determines whether two specified instances of DateTime are equal.
Public operatorStatic memberSubtraction(DateTime, DateTime)
Subtracts a specified date and time from another specified date and time and returns a time interval.
Public operatorStatic memberSubtraction(DateTime, TimeSpan)
Subtracts a specified time interval from a specified date and time and returns a new date and time.
Top
Fields
  NameDescription
Public fieldStatic memberMaxValue
Represents the largest possible value of DateTime. This field is read-only.
Public fieldStatic memberMinValue
Represents the smallest possible value of DateTime. This field is read-only.
Top
Properties
  NameDescription
Public propertyDate
Gets the date component of this instance.
Public propertyDay
Gets the day of the month represented by this instance.
Public propertyDayOfWeek
Gets the day of the week represented by this instance.
Public propertyHour
Gets the hour component of the date represented by this instance.
Public propertyKind
Gets a value that indicates whether the time represented by this instance is based on local time, Coordinated Universal Time (UTC), or neither.
Public propertyMinute
Gets the minute component of the date represented by this instance.
Public propertyMonth
Gets the month component of the date represented by this instance.
Public propertyStatic memberNow
Gets a DateTime object that is set to the current date and time on this computer, expressed as the local time.
Public propertySecond
Gets the seconds component of the date represented by this instance.
Public propertyStatic memberUtcNow
Gets a DateTime object that is set to the current date and time on this computer, expressed as the Coordinated Universal Time (UTC).
Public propertyYear
Gets the year component of the date represented by this instance.
Top
See Also