DateTime Structure |
Namespace: System
[SerializableAttribute] public struct DateTime : IComparable, IFormattable, IConvertible, ISerializable, IComparable<DateTime>, IEquatable<DateTime>
The DateTime type exposes the following members.
Name | Description | |
---|---|---|
AddDays | Returns a new DateTime that adds the specified number of days to the value of this instance. | |
Equals(DateTime) | Returns a value indicating whether the value of this instance is equal to the value of the specified DateTime instance. | |
Equals(Object) | Returns a value indicating whether this instance is equal to a specified object. (Overrides ValueTypeEquals(Object).) | |
Equals(DateTime, DateTime) | Returns a value indicating whether two DateTime instances have the same date and time value. | |
GetHashCode | Returns the hash code for this instance. (Overrides ValueTypeGetHashCode.) | |
GetType | Gets the Type of the current instance. (Inherited from Object.) | |
Parse(String) | Converts the specified string representation of a date and time to its DateTime equivalent. | |
Parse(String, IFormatProvider) | Converts the specified string representation of a date and time to its DateTime equivalent using the specified culture-specific format information. | |
Parse(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. | |
ToString | Converts the value of the current DateTime object to its equivalent string representation. (Overrides ValueTypeToString.) | |
ToString(IFormatProvider) | Converts the value of the current DateTime object to its equivalent string representation using the specified culture-specific format information. | |
ToString(String) | Converts the value of the current DateTime object to its equivalent string representation using the specified format. | |
ToString(String, IFormatProvider) | Converts the value of the current DateTime object to its equivalent string representation using the specified format and culture-specific format information. | |
ToUniversalTime | Converts the value of the current DateTime object to Coordinated Universal Time (UTC). | |
TryParse(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. | |
TryParse(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. |
Name | Description | |
---|---|---|
Equality | Determines whether two specified instances of DateTime are equal. | |
Subtraction(DateTime, DateTime) | Subtracts a specified date and time from another specified date and time and returns a time interval. | |
Subtraction(DateTime, TimeSpan) | Subtracts a specified time interval from a specified date and time and returns a new date and time. |
Name | Description | |
---|---|---|
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. |
Name | Description | |
---|---|---|
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. | |
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. | |
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. | |
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. |