DateTime Members

The following tables list the members exposed by the DateTime type.

Public Constructors

Name Description
Public Method DateTime Overloaded. Initializes a new instance of the DateTime structure.

Public Fields

Name Description
Public Field Static MaxValue Represents the largest possible value for a DateTime object. Note that this field is read-only.
Public Field Static MinValue Represents the smallest possible value for a DateTime object. Note that this field is read-only.

Public Properties

Name Description
Public Property Date Gets the date component of current DateTime object.
Public Property Day Gets the day-of-the-month component of the current DateTime object.
Public Property DayOfWeek Gets the day-of-the-week component of the current DateTime object.
Public Property DayOfYear Gets the day-of-the-year component of the current DateTime object.
Public Property Hour Gets the hours component of the current DateTime object.
Public Property Kind Gets a value that indicates whether the time represented by this instance is based on local time, Coordinated Universal Time (UTC), or neither.
Public Property Millisecond Gets the milliseconds component of the current DateTime object.
Public Property Minute Gets the minutes component of the current DateTime object.
Public Property Month Gets the month component of the current DateTime object.
Public Property Static Now Gets the system's current date and time, expressed in local time.
Public Property Second Gets the seconds component of the current DateTime object.
Public Property Ticks Gets the current number of ticks in the current DateTime object.
Public Property TimeOfDay Gets the time-of-day component of the current DateTime object.
Public Property Static Today Gets the current date.
Public Property Static UtcNow Gets the system's current date and time, expressed in Coordinated Universal Time (UTC).
Public Property Year Gets the year component of the current DateTime object.

Public Methods

Name Description
Public Method Add Adds a specified time period to the current DateTime object, yielding a new DateTime object.
Public Method AddDays Adds a specified number of days to the current DateTime object.
Public Method AddHours Adds a specified number of hours to the current DateTime object.
Public Method AddMilliseconds Adds a specified number of milliseconds to the current DateTime object.
Public Method AddMinutes Adds a specified number of minutes to the current DateTime object.
Public Method AddSeconds Adds a specified number of seconds to the current DateTime object.
Public Method AddTicks Adds a specified number of ticks to the current DateTime object.
Public Method Static Compare Compares two date/time values in order to determine their relative value.
Public Method CompareTo Compares a specified date/time to this date/time instance in order to determine their relative value.
Public Method Static DaysInMonth Returns the number of days in a specified month of a specified year.
Public Method Equals Overloaded. Determines whether two DateTime objects have identical values.
Public Method GetHashCode (Inherited from Object.)
Public Method GetType (Inherited from Object.)
Public Method Static operator - Overloaded. Subtracts one DateTime object from another one, or subtracts a specified time period from a specified DateTime object.
Public Method Static operator != Determines whether two specified DateTime objects are not equal.
Public Method Static operator + Adds a specified period of time to a specified DateTime object, yielding a new DateTime object.
Public Method Static operator < Determines whether one DateTime object is less than another one.
Public Method Static operator <= Determines whether one DateTime is less than or equal to another one.
Public Method Static operator == Determines whether two specified DateTime objects have the same date/time value.
Public Method Static operator > Determines whether one DateTime object is greater than another one.
Public Method Static operator >= Determines whether one DateTime object is greater than or equal to another one.
Public Method ReferenceEquals (Inherited from Object.)
Public Method Static 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.
Public Method Subtract Overloaded. Subtracts either a time period or another DateTime object from the current DateTime object.
Public Method ToLocalTime Converts the current value of the current DateTime object to local time.
Public Method ToString Overloaded. Converts the value of the current DateTime object to its equivalent string representation.
Public Method ToUniversalTime Converts the value of the current DateTime object to Coordinated Universal Time (UTC).

See Also

Reference

DateTime Structure
System Namespace