DateTime Members
Article
09/08/2011
3 minutes to read
In this article
The following tables list the members exposed by the DateTime type.
Public Constructors
Public Fields
MaxValue
Represents the largest possible value for a DateTime object. Note that this field is read-only.
MinValue
Represents the smallest possible value for a DateTime object. Note that this field is read-only.
Public Properties
Date
Gets the date component of current DateTime object.
Day
Gets the day-of-the-month component of the current DateTime object.
DayOfWeek
Gets the day-of-the-week component of the current DateTime object.
DayOfYear
Gets the day-of-the-year component of the current DateTime object.
Hour
Gets the hours component of the current DateTime object.
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 current DateTime object.
Minute
Gets the minutes component of the current DateTime object.
Month
Gets the month component of the current DateTime object.
Now
Gets the system's current date and time, expressed in local time.
Second
Gets the seconds component of the current DateTime object.
Ticks
Gets the current number of ticks in the current DateTime object.
TimeOfDay
Gets the time-of-day component of the current DateTime object.
Today
Gets the current date.
UtcNow
Gets the system's current date and time, expressed in Coordinated Universal Time (UTC).
Year
Gets the year component of the current DateTime object.
Public Methods
Add
Adds a specified time period to the current DateTime object, yielding a new DateTime object.
AddDays
Adds a specified number of days to the current DateTime object.
AddHours
Adds a specified number of hours to the current DateTime object.
AddMilliseconds
Adds a specified number of milliseconds to the current DateTime object.
AddMinutes
Adds a specified number of minutes to the current DateTime object.
AddSeconds
Adds a specified number of seconds to the current DateTime object.
AddTicks
Adds a specified number of ticks to the current DateTime object.
Compare
Compares two date/time values in order to determine their relative value.
CompareTo
Compares a specified date/time to this date/time instance in order to determine their relative value.
DaysInMonth
Returns the number of days in a specified month of a specified year.
Equals
Overloaded. Determines whether two DateTime objects have identical values.
GetHashCode
(Inherited from Object .)
GetType
(Inherited from Object .)
operator -
Overloaded. Subtracts one DateTime object from another one, or subtracts a specified time period from a specified DateTime object.
operator !=
Determines whether two specified DateTime objects are not equal.
operator +
Adds a specified period of time to a specified DateTime object, yielding a new DateTime object.
operator <
Determines whether one DateTime object is less than another one.
operator <=
Determines whether one DateTime is less than or equal to another one.
operator ==
Determines whether two specified DateTime objects have the same date/time value.
operator >
Determines whether one DateTime object is greater than another one.
operator >=
Determines whether one DateTime object is greater than or equal to another one.
ReferenceEquals
(Inherited from Object .)
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.
Subtract
Overloaded. Subtracts either a time period or another DateTime object from the current DateTime object.
ToLocalTime
Converts the current value of the current DateTime object to local time.
ToString
Overloaded. 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).
See Also
Reference
DateTime Structure
System Namespace