mscorlib(4.0.0.0) API with additions
|
Represents an instant in time, typically expressed as a date and time of day. To browse the .NET Framework source code for this type, see the Reference Source. More...
Public Member Functions | |
DateTime (long ticks) | |
Initializes a new instance of the T:System.DateTime structure to a specified number of ticks. More... | |
DateTime (long ticks, DateTimeKind kind) | |
Initializes a new instance of the T:System.DateTime structure to a specified number of ticks and to Coordinated Universal Time (UTC) or local time. More... | |
internal | DateTime (long ticks, DateTimeKind kind, bool isAmbiguousDst) |
DateTime (int year, int month, int day) | |
Initializes a new instance of the T:System.DateTime structure to the specified year, month, and day. More... | |
DateTime (int year, int month, int day, Calendar calendar) | |
Initializes a new instance of the T:System.DateTime structure to the specified year, month, and day for the specified calendar. More... | |
DateTime (int year, int month, int day, int hour, int minute, int second) | |
Initializes a new instance of the T:System.DateTime structure to the specified year, month, day, hour, minute, and second. More... | |
DateTime (int year, int month, int day, int hour, int minute, int second, DateTimeKind kind) | |
Initializes a new instance of the T:System.DateTime structure to the specified year, month, day, hour, minute, second, and Coordinated Universal Time (UTC) or local time. More... | |
DateTime (int year, int month, int day, int hour, int minute, int second, Calendar calendar) | |
Initializes a new instance of the T:System.DateTime structure to the specified year, month, day, hour, minute, and second for the specified calendar. More... | |
DateTime (int year, int month, int day, int hour, int minute, int second, int millisecond) | |
Initializes a new instance of the T:System.DateTime structure to the specified year, month, day, hour, minute, second, and millisecond. More... | |
DateTime (int year, int month, int day, int hour, int minute, int second, int millisecond, DateTimeKind kind) | |
Initializes a new instance of the T:System.DateTime structure to the specified year, month, day, hour, minute, second, millisecond, and Coordinated Universal Time (UTC) or local time. More... | |
DateTime (int year, int month, int day, int hour, int minute, int second, int millisecond, Calendar calendar) | |
Initializes a new instance of the T:System.DateTime structure to the specified year, month, day, hour, minute, second, and millisecond for the specified calendar. More... | |
DateTime (int year, int month, int day, int hour, int minute, int second, int millisecond, Calendar calendar, DateTimeKind kind) | |
Initializes a new instance of the T:System.DateTime structure to the specified year, month, day, hour, minute, second, millisecond, and Coordinated Universal Time (UTC) or local time for the specified calendar. More... | |
DateTime | Add (TimeSpan value) |
Returns a new T:System.DateTime that adds the value of the specified T:System.TimeSpan to the value of this instance. More... | |
DateTime | AddDays (double value) |
Returns a new T:System.DateTime that adds the specified number of days to the value of this instance. More... | |
DateTime | AddHours (double value) |
Returns a new T:System.DateTime that adds the specified number of hours to the value of this instance. More... | |
DateTime | AddMilliseconds (double value) |
Returns a new T:System.DateTime that adds the specified number of milliseconds to the value of this instance. More... | |
DateTime | AddMinutes (double value) |
Returns a new T:System.DateTime that adds the specified number of minutes to the value of this instance. More... | |
DateTime | AddMonths (int months) |
Returns a new T:System.DateTime that adds the specified number of months to the value of this instance. More... | |
DateTime | AddSeconds (double value) |
Returns a new T:System.DateTime that adds the specified number of seconds to the value of this instance. More... | |
DateTime | AddTicks (long value) |
Returns a new T:System.DateTime that adds the specified number of ticks to the value of this instance. More... | |
DateTime | AddYears (int value) |
Returns a new T:System.DateTime that adds the specified number of years to the value of this instance. More... | |
int | CompareTo (object value) |
Compares the value of this instance to a specified object that contains a specified T:System.DateTime value, and returns an integer that indicates whether this instance is earlier than, the same as, or later than the specified T:System.DateTime value. More... | |
int | CompareTo (DateTime value) |
Compares the value of this instance to a specified T:System.DateTime value and returns an integer that indicates whether this instance is earlier than, the same as, or later than the specified T:System.DateTime value. More... | |
static internal bool | LegacyParseMode () |
static internal bool | EnableAmPmParseAdjustment () |
override bool | Equals (object value) |
Returns a value indicating whether this instance is equal to a specified object. More... | |
bool | Equals (DateTime value) |
Returns a value indicating whether the value of this instance is equal to the value of the specified T:System.DateTime instance. More... | |
void ISerializable. | GetObjectData (SerializationInfo info, StreamingContext context) |
Populates a T:System.Runtime.Serialization.SerializationInfo object with the data needed to serialize the current T:System.DateTime object. More... | |
bool | IsDaylightSavingTime () |
Indicates whether this instance of T:System.DateTime is within the daylight saving time range for the current time zone. More... | |
long | ToBinary () |
Serializes the current T:System.DateTime object to a 64-bit binary value that subsequently can be used to recreate the T:System.DateTime object. More... | |
internal long | ToBinaryRaw () |
override int | GetHashCode () |
Returns the hash code for this instance. More... | |
internal bool | IsAmbiguousDaylightSavingTime () |
static internal long | GetSystemTimeAsFileTime () |
TimeSpan | Subtract (DateTime value) |
Subtracts the specified date and time from this instance. More... | |
DateTime | Subtract (TimeSpan value) |
Subtracts the specified duration from this instance. More... | |
double | ToOADate () |
Converts the value of this instance to the equivalent OLE Automation date. More... | |
long | ToFileTime () |
Converts the value of the current T:System.DateTime object to a Windows file time. More... | |
long | ToFileTimeUtc () |
Converts the value of the current T:System.DateTime object to a Windows file time. More... | |
DateTime | ToLocalTime () |
Converts the value of the current T:System.DateTime object to local time. More... | |
internal DateTime | ToLocalTime (bool throwOnOverflow) |
string | ToLongDateString () |
Converts the value of the current T:System.DateTime object to its equivalent long date string representation. More... | |
string | ToLongTimeString () |
Converts the value of the current T:System.DateTime object to its equivalent long time string representation. More... | |
string | ToShortDateString () |
Converts the value of the current T:System.DateTime object to its equivalent short date string representation. More... | |
string | ToShortTimeString () |
Converts the value of the current T:System.DateTime object to its equivalent short time string representation. More... | |
override string | ToString () |
Converts the value of the current T:System.DateTime object to its equivalent string representation using the formatting conventions of the current culture. More... | |
string | ToString (string format) |
Converts the value of the current T:System.DateTime object to its equivalent string representation using the specified format and the formatting conventions of the current culture. More... | |
string | ToString (IFormatProvider provider) |
Converts the value of the current T:System.DateTime object to its equivalent string representation using the specified culture-specific format information. More... | |
string | ToString (string format, IFormatProvider provider) |
Converts the value of the current T:System.DateTime object to its equivalent string representation using the specified format and culture-specific format information. More... | |
DateTime | ToUniversalTime () |
Converts the value of the current T:System.DateTime object to Coordinated Universal Time (UTC). More... | |
string [] | GetDateTimeFormats () |
Converts the value of this instance to all the string representations supported by the standard date and time format specifiers. More... | |
string [] | GetDateTimeFormats (IFormatProvider provider) |
Converts the value of this instance to all the string representations supported by the standard date and time format specifiers and the specified culture-specific formatting information. More... | |
string [] | GetDateTimeFormats (char format) |
Converts the value of this instance to all the string representations supported by the specified standard date and time format specifier. More... | |
string [] | GetDateTimeFormats (char format, IFormatProvider provider) |
Converts the value of this instance to all the string representations supported by the specified standard date and time format specifier and culture-specific formatting information. More... | |
TypeCode | GetTypeCode () |
Returns the T:System.TypeCode for value type T:System.DateTime. More... | |
bool IConvertible. | ToBoolean (IFormatProvider provider) |
This conversion is not supported. Attempting to use this method throws an T:System.InvalidCastException. More... | |
char IConvertible. | ToChar (IFormatProvider provider) |
This conversion is not supported. Attempting to use this method throws an T:System.InvalidCastException. More... | |
sbyte IConvertible. | ToSByte (IFormatProvider provider) |
This conversion is not supported. Attempting to use this method throws an T:System.InvalidCastException. More... | |
byte IConvertible. | ToByte (IFormatProvider provider) |
This conversion is not supported. Attempting to use this method throws an T:System.InvalidCastException. More... | |
short IConvertible. | ToInt16 (IFormatProvider provider) |
This conversion is not supported. Attempting to use this method throws an T:System.InvalidCastException. More... | |
ushort IConvertible. | ToUInt16 (IFormatProvider provider) |
This conversion is not supported. Attempting to use this method throws an T:System.InvalidCastException. More... | |
int IConvertible. | ToInt32 (IFormatProvider provider) |
This conversion is not supported. Attempting to use this method throws an T:System.InvalidCastException. More... | |
uint IConvertible. | ToUInt32 (IFormatProvider provider) |
This conversion is not supported. Attempting to use this method throws an T:System.InvalidCastException. More... | |
long IConvertible. | ToInt64 (IFormatProvider provider) |
This conversion is not supported. Attempting to use this method throws an T:System.InvalidCastException. More... | |
ulong IConvertible. | ToUInt64 (IFormatProvider provider) |
This conversion is not supported. Attempting to use this method throws an T:System.InvalidCastException. More... | |
float IConvertible. | ToSingle (IFormatProvider provider) |
This conversion is not supported. Attempting to use this method throws an T:System.InvalidCastException. More... | |
double IConvertible. | ToDouble (IFormatProvider provider) |
This conversion is not supported. Attempting to use this method throws an T:System.InvalidCastException. More... | |
decimal IConvertible. | ToDecimal (IFormatProvider provider) |
This conversion is not supported. Attempting to use this method throws an T:System.InvalidCastException. More... | |
DateTime IConvertible. | ToDateTime (IFormatProvider provider) |
Returns the current T:System.DateTime object. More... | |
object IConvertible. | ToType (Type type, IFormatProvider provider) |
Converts the current T:System.DateTime object to an object of a specified type. More... | |
![]() | |
bool | Equals (T other) |
Indicates whether the current object is equal to another object of the same type. More... | |
Static Public Member Functions | |
static int | Compare (DateTime t1, DateTime t2) |
Compares two instances of T:System.DateTime and returns an integer that indicates whether the first instance is earlier than, the same as, or later than the second instance. More... | |
static int | DaysInMonth (int year, int month) |
Returns the number of days in the specified month and year. More... | |
static internal long | DoubleDateToTicks (double value) |
static bool | Equals (DateTime t1, DateTime t2) |
Returns a value indicating whether two T:System.DateTime instances have the same date and time value. More... | |
static DateTime | FromBinary (long dateData) |
Deserializes a 64-bit binary value and recreates an original serialized T:System.DateTime object. More... | |
static internal DateTime | FromBinaryRaw (long dateData) |
static DateTime | FromFileTime (long fileTime) |
Converts the specified Windows file time to an equivalent local time. More... | |
static DateTime | FromFileTimeUtc (long fileTime) |
Converts the specified Windows file time to an equivalent UTC time. More... | |
static DateTime | FromOADate (double d) |
Returns a T:System.DateTime equivalent to the specified OLE Automation Date. More... | |
static DateTime | SpecifyKind (DateTime value, DateTimeKind kind) |
Creates a new T:System.DateTime object that has the same number of ticks as the specified T:System.DateTime, but is designated as either local time, Coordinated Universal Time (UTC), or neither, as indicated by the specified T:System.DateTimeKind value. More... | |
static bool | IsLeapYear (int year) |
Returns an indication whether the specified year is a leap year. More... | |
static DateTime | Parse (string s) |
Converts the string representation of a date and time to its T:System.DateTime equivalent. More... | |
static DateTime | Parse (string s, IFormatProvider provider) |
Converts the string representation of a date and time to its T:System.DateTime equivalent by using culture-specific format information. More... | |
static DateTime | Parse (string s, IFormatProvider provider, DateTimeStyles styles) |
Converts the string representation of a date and time to its T:System.DateTime equivalent by using culture-specific format information and formatting style. More... | |
static DateTime | ParseExact (string s, string format, IFormatProvider provider) |
Converts the specified string representation of a date and time to its T:System.DateTime equivalent using the specified format and culture-specific format information. The format of the string representation must match the specified format exactly. More... | |
static DateTime | ParseExact (string s, string format, IFormatProvider provider, DateTimeStyles style) |
Converts the specified string representation of a date and time to its T:System.DateTime equivalent using the specified format, culture-specific format information, and style. The format of the string representation must match the specified format exactly or an exception is thrown. More... | |
static DateTime | ParseExact (string s, string[] formats, IFormatProvider provider, DateTimeStyles style) |
Converts the specified string representation of a date and time to its T:System.DateTime equivalent using the specified array of formats, culture-specific format information, and style. The format of the string representation must match at least one of the specified formats exactly or an exception is thrown. More... | |
static bool | TryParse (string s, out DateTime result) |
Converts the specified string representation of a date and time to its T:System.DateTime equivalent and returns a value that indicates whether the conversion succeeded. More... | |
static bool | TryParse (string s, IFormatProvider provider, DateTimeStyles styles, out DateTime result) |
Converts the specified string representation of a date and time to its T:System.DateTime equivalent using the specified culture-specific format information and formatting style, and returns a value that indicates whether the conversion succeeded. More... | |
static bool | TryParseExact (string s, string format, IFormatProvider provider, DateTimeStyles style, out DateTime result) |
Converts the specified string representation of a date and time to its T:System.DateTime equivalent using the specified format, culture-specific format information, and style. The format of the string representation must match the specified format exactly. The method returns a value that indicates whether the conversion succeeded. More... | |
static bool | TryParseExact (string s, string[] formats, IFormatProvider provider, DateTimeStyles style, out DateTime result) |
Converts the specified string representation of a date and time to its T:System.DateTime equivalent using the specified array of formats, culture-specific format information, and style. The format of the string representation must match at least one of the specified formats exactly. The method returns a value that indicates whether the conversion succeeded. More... | |
static DateTime | operator+ (DateTime d, TimeSpan t) |
Adds a specified time interval to a specified date and time, yielding a new date and time. More... | |
static DateTime | operator - (DateTime d, TimeSpan t) |
Subtracts a specified time interval from a specified date and time and returns a new date and time. More... | |
static TimeSpan | operator - (DateTime d1, DateTime d2) |
Subtracts a specified date and time from another specified date and time and returns a time interval. More... | |
static bool | operator== (DateTime d1, DateTime d2) |
Determines whether two specified instances of T:System.DateTime are equal. More... | |
static bool | operator != (DateTime d1, DateTime d2) |
Determines whether two specified instances of T:System.DateTime are not equal. More... | |
static bool | operator< (DateTime t1, DateTime t2) |
Determines whether one specified T:System.DateTime is earlier than another specified T:System.DateTime. More... | |
static bool | operator<= (DateTime t1, DateTime t2) |
Determines whether one specified T:System.DateTime represents a date and time that is the same as or earlier than another specified T:System.DateTime. More... | |
static bool | operator > (DateTime t1, DateTime t2) |
Determines whether one specified T:System.DateTime is later than another specified T:System.DateTime. More... | |
static bool | operator >= (DateTime t1, DateTime t2) |
Determines whether one specified T:System.DateTime represents a date and time that is the same as or later than another specified T:System.DateTime. More... | |
static internal bool | TryCreate (int year, int month, int day, int hour, int minute, int second, int millisecond, out DateTime result) |
Static Public Attributes | |
static readonly DateTime | MinValue = new DateTime(0L, DateTimeKind.Unspecified) |
Represents the smallest possible value of T:System.DateTime. This field is read-only. More... | |
static readonly DateTime | MaxValue = new DateTime(3155378975999999999L, DateTimeKind.Unspecified) |
Represents the largest possible value of T:System.DateTime. This field is read-only. More... | |
Properties | |
DateTime | Date [get] |
Gets the date component of this instance. More... | |
int | Day [get] |
Gets the day of the month represented by this instance. More... | |
DayOfWeek | DayOfWeek [get] |
Gets the day of the week represented by this instance. More... | |
int | DayOfYear [get] |
Gets the day of the year represented by this instance. More... | |
int | Hour [get] |
Gets the hour component of the date represented by this instance. More... | |
DateTimeKind | Kind [get] |
Gets a value that indicates whether the time represented by this instance is based on local time, Coordinated Universal Time (UTC), or neither. More... | |
int | Millisecond [get] |
Gets the milliseconds component of the date represented by this instance. More... | |
int | Minute [get] |
Gets the minute component of the date represented by this instance. More... | |
int | Month [get] |
Gets the month component of the date represented by this instance. More... | |
static DateTime | Now [get] |
Gets a T:System.DateTime object that is set to the current date and time on this computer, expressed as the local time. More... | |
static DateTime | UtcNow [get] |
Gets a T:System.DateTime object that is set to the current date and time on this computer, expressed as the Coordinated Universal Time (UTC). More... | |
int | Second [get] |
Gets the seconds component of the date represented by this instance. More... | |
long | Ticks [get] |
Gets the number of ticks that represent the date and time of this instance. More... | |
TimeSpan | TimeOfDay [get] |
Gets the time of day for this instance. More... | |
static DateTime | Today [get] |
Gets the current date. More... | |
int | Year [get] |
Gets the year component of the date represented by this instance. More... | |
Represents an instant in time, typically expressed as a date and time of day. To browse the .NET Framework source code for this type, see the Reference Source.
Definition at line 13 of file DateTime.cs.
System.DateTime.DateTime | ( | long | ticks | ) |
Initializes a new instance of the T:System.DateTime structure to a specified number of ticks.
ticks | A date and time expressed in the number of 100-nanosecond intervals that have elapsed since January 1, 0001 at 00:00:00.000 in the Gregorian calendar. |
T:System.ArgumentOutOfRangeException | ticks is less than F:System.DateTime.MinValue or greater than F:System.DateTime.MaxValue. |
Definition at line 364 of file DateTime.cs.
System.DateTime.DateTime | ( | long | ticks, |
DateTimeKind | kind | ||
) |
Initializes a new instance of the T:System.DateTime structure to a specified number of ticks and to Coordinated Universal Time (UTC) or local time.
ticks | A date and time expressed in the number of 100-nanosecond intervals that have elapsed since January 1, 0001 at 00:00:00.000 in the Gregorian calendar. |
kind | One of the enumeration values that indicates whether ticks specifies a local time, Coordinated Universal Time (UTC), or neither. |
T:System.ArgumentOutOfRangeException | ticks is less than F:System.DateTime.MinValue or greater than F:System.DateTime.MaxValue. |
T:System.ArgumentException | kind is not one of the T:System.DateTimeKind values. |
Definition at line 386 of file DateTime.cs.
System.DateTime.DateTime | ( | int | year, |
int | month, | ||
int | day | ||
) |
Initializes a new instance of the T:System.DateTime structure to the specified year, month, and day.
year | The year (1 through 9999). |
month | The month (1 through 12). |
day | The day (1 through the number of days in month ). |
T:System.ArgumentOutOfRangeException | year is less than 1 or greater than 9999.-or- month is less than 1 or greater than 12.-or- day is less than 1 or greater than the number of days in month . |
Definition at line 417 of file DateTime.cs.
System.DateTime.DateTime | ( | int | year, |
int | month, | ||
int | day, | ||
Calendar | calendar | ||
) |
Initializes a new instance of the T:System.DateTime structure to the specified year, month, and day for the specified calendar.
year | The year (1 through the number of years in calendar ). |
month | The month (1 through the number of months in calendar ). |
day | The day (1 through the number of days in month ). |
calendar | The calendar that is used to interpret year , month , and day . |
T:System.ArgumentNullException | calendar is null . |
T:System.ArgumentOutOfRangeException | year is not in the range supported by calendar .-or- month is less than 1 or greater than the number of months in calendar .-or- day is less than 1 or greater than the number of days in month . |
Definition at line 433 of file DateTime.cs.
System.DateTime.DateTime | ( | int | year, |
int | month, | ||
int | day, | ||
int | hour, | ||
int | minute, | ||
int | second | ||
) |
Initializes a new instance of the T:System.DateTime structure to the specified year, month, day, hour, minute, and second.
year | The year (1 through 9999). |
month | The month (1 through 12). |
day | The day (1 through the number of days in month ). |
hour | The hours (0 through 23). |
minute | The minutes (0 through 59). |
second | The seconds (0 through 59). |
T:System.ArgumentOutOfRangeException | year is less than 1 or greater than 9999. -or- month is less than 1 or greater than 12. -or- day is less than 1 or greater than the number of days in month .-or- hour is less than 0 or greater than 23. -or- minute is less than 0 or greater than 59. -or- second is less than 0 or greater than 59. |
Definition at line 453 of file DateTime.cs.
System.DateTime.DateTime | ( | int | year, |
int | month, | ||
int | day, | ||
int | hour, | ||
int | minute, | ||
int | second, | ||
DateTimeKind | kind | ||
) |
Initializes a new instance of the T:System.DateTime structure to the specified year, month, day, hour, minute, second, and Coordinated Universal Time (UTC) or local time.
year | The year (1 through 9999). |
month | The month (1 through 12). |
day | The day (1 through the number of days in month ). |
hour | The hours (0 through 23). |
minute | The minutes (0 through 59). |
second | The seconds (0 through 59). |
kind | One of the enumeration values that indicates whether year , month , day , hour , minute and second specify a local time, Coordinated Universal Time (UTC), or neither. |
T:System.ArgumentOutOfRangeException | year is less than 1 or greater than 9999. -or- month is less than 1 or greater than 12. -or- day is less than 1 or greater than the number of days in month .-or- hour is less than 0 or greater than 23. -or- minute is less than 0 or greater than 59. -or- second is less than 0 or greater than 59. |
T:System.ArgumentException | kind is not one of the T:System.DateTimeKind values. |
Definition at line 476 of file DateTime.cs.
System.DateTime.DateTime | ( | int | year, |
int | month, | ||
int | day, | ||
int | hour, | ||
int | minute, | ||
int | second, | ||
Calendar | calendar | ||
) |
Initializes a new instance of the T:System.DateTime structure to the specified year, month, day, hour, minute, and second for the specified calendar.
year | The year (1 through the number of years in calendar ). |
month | The month (1 through the number of months in calendar ). |
day | The day (1 through the number of days in month ). |
hour | The hours (0 through 23). |
minute | The minutes (0 through 59). |
second | The seconds (0 through 59). |
calendar | The calendar that is used to interpret year , month , and day . |
T:System.ArgumentNullException | calendar is null . |
T:System.ArgumentOutOfRangeException | year is not in the range supported by calendar .-or- month is less than 1 or greater than the number of months in calendar .-or- day is less than 1 or greater than the number of days in month .-or- hour is less than 0 or greater than 23 -or- minute is less than 0 or greater than 59. -or- second is less than 0 or greater than 59. |
Definition at line 503 of file DateTime.cs.
System.DateTime.DateTime | ( | int | year, |
int | month, | ||
int | day, | ||
int | hour, | ||
int | minute, | ||
int | second, | ||
int | millisecond | ||
) |
Initializes a new instance of the T:System.DateTime structure to the specified year, month, day, hour, minute, second, and millisecond.
year | The year (1 through 9999). |
month | The month (1 through 12). |
day | The day (1 through the number of days in month ). |
hour | The hours (0 through 23). |
minute | The minutes (0 through 59). |
second | The seconds (0 through 59). |
millisecond | The milliseconds (0 through 999). |
T:System.ArgumentOutOfRangeException | year is less than 1 or greater than 9999.-or- month is less than 1 or greater than 12.-or- day is less than 1 or greater than the number of days in month .-or- hour is less than 0 or greater than 23.-or- minute is less than 0 or greater than 59.-or- second is less than 0 or greater than 59.-or- millisecond is less than 0 or greater than 999. |
Definition at line 529 of file DateTime.cs.
System.DateTime.DateTime | ( | int | year, |
int | month, | ||
int | day, | ||
int | hour, | ||
int | minute, | ||
int | second, | ||
int | millisecond, | ||
DateTimeKind | kind | ||
) |
Initializes a new instance of the T:System.DateTime structure to the specified year, month, day, hour, minute, second, millisecond, and Coordinated Universal Time (UTC) or local time.
year | The year (1 through 9999). |
month | The month (1 through 12). |
day | The day (1 through the number of days in month ). |
hour | The hours (0 through 23). |
minute | The minutes (0 through 59). |
second | The seconds (0 through 59). |
millisecond | The milliseconds (0 through 999). |
kind | One of the enumeration values that indicates whether year , month , day , hour , minute , second , and millisecond specify a local time, Coordinated Universal Time (UTC), or neither. |
T:System.ArgumentOutOfRangeException | year is less than 1 or greater than 9999.-or- month is less than 1 or greater than 12.-or- day is less than 1 or greater than the number of days in month .-or- hour is less than 0 or greater than 23.-or- minute is less than 0 or greater than 59.-or- second is less than 0 or greater than 59.-or- millisecond is less than 0 or greater than 999. |
T:System.ArgumentException | kind is not one of the T:System.DateTimeKind values. |
Definition at line 564 of file DateTime.cs.
System.DateTime.DateTime | ( | int | year, |
int | month, | ||
int | day, | ||
int | hour, | ||
int | minute, | ||
int | second, | ||
int | millisecond, | ||
Calendar | calendar | ||
) |
Initializes a new instance of the T:System.DateTime structure to the specified year, month, day, hour, minute, second, and millisecond for the specified calendar.
year | The year (1 through the number of years in calendar ). |
month | The month (1 through the number of months in calendar ). |
day | The day (1 through the number of days in month ). |
hour | The hours (0 through 23). |
minute | The minutes (0 through 59). |
second | The seconds (0 through 59). |
millisecond | The milliseconds (0 through 999). |
calendar | The calendar that is used to interpret year , month , and day . |
T:System.ArgumentNullException | calendar is null . |
T:System.ArgumentOutOfRangeException | year is not in the range supported by calendar .-or- month is less than 1 or greater than the number of months in calendar .-or- day is less than 1 or greater than the number of days in month .-or- hour is less than 0 or greater than 23.-or- minute is less than 0 or greater than 59.-or- second is less than 0 or greater than 59.-or- millisecond is less than 0 or greater than 999. |
Definition at line 602 of file DateTime.cs.
System.DateTime.DateTime | ( | int | year, |
int | month, | ||
int | day, | ||
int | hour, | ||
int | minute, | ||
int | second, | ||
int | millisecond, | ||
Calendar | calendar, | ||
DateTimeKind | kind | ||
) |
Initializes a new instance of the T:System.DateTime structure to the specified year, month, day, hour, minute, second, millisecond, and Coordinated Universal Time (UTC) or local time for the specified calendar.
year | The year (1 through the number of years in calendar ). |
month | The month (1 through the number of months in calendar ). |
day | The day (1 through the number of days in month ). |
hour | The hours (0 through 23). |
minute | The minutes (0 through 59). |
second | The seconds (0 through 59). |
millisecond | The milliseconds (0 through 999). |
calendar | The calendar that is used to interpret year , month , and day . |
kind | One of the enumeration values that indicates whether year , month , day , hour , minute , second , and millisecond specify a local time, Coordinated Universal Time (UTC), or neither. |
T:System.ArgumentNullException | calendar is null . |
T:System.ArgumentOutOfRangeException | year is not in the range supported by calendar .-or- month is less than 1 or greater than the number of months in calendar .-or- day is less than 1 or greater than the number of days in month .-or- hour is less than 0 or greater than 23.-or- minute is less than 0 or greater than 59.-or- second is less than 0 or greater than 59.-or- millisecond is less than 0 or greater than 999. |
T:System.ArgumentException | kind is not one of the T:System.DateTimeKind values. |
Definition at line 643 of file DateTime.cs.
Returns a new T:System.DateTime that adds the value of the specified T:System.TimeSpan to the value of this instance.
value | A positive or negative time interval. |
T:System.ArgumentOutOfRangeException | The resulting T:System.DateTime is less than F:System.DateTime.MinValue or greater than F:System.DateTime.MaxValue. |
Definition at line 718 of file DateTime.cs.
DateTime System.DateTime.AddDays | ( | double | value | ) |
Returns a new T:System.DateTime that adds the specified number of days to the value of this instance.
value | A number of whole and fractional days. The value parameter can be negative or positive. |
T:System.ArgumentOutOfRangeException | The resulting T:System.DateTime is less than F:System.DateTime.MinValue or greater than F:System.DateTime.MaxValue. |
Definition at line 738 of file DateTime.cs.
DateTime System.DateTime.AddHours | ( | double | value | ) |
Returns a new T:System.DateTime that adds the specified number of hours to the value of this instance.
value | A number of whole and fractional hours. The value parameter can be negative or positive. |
T:System.ArgumentOutOfRangeException | The resulting T:System.DateTime is less than F:System.DateTime.MinValue or greater than F:System.DateTime.MaxValue. |
Definition at line 748 of file DateTime.cs.
DateTime System.DateTime.AddMilliseconds | ( | double | value | ) |
Returns a new T:System.DateTime that adds the specified number of milliseconds to the value of this instance.
value | A number of whole and fractional milliseconds. The value parameter can be negative or positive. Note that this value is rounded to the nearest integer. |
T:System.ArgumentOutOfRangeException | The resulting T:System.DateTime is less than F:System.DateTime.MinValue or greater than F:System.DateTime.MaxValue. |
Definition at line 758 of file DateTime.cs.
DateTime System.DateTime.AddMinutes | ( | double | value | ) |
Returns a new T:System.DateTime that adds the specified number of minutes to the value of this instance.
value | A number of whole and fractional minutes. The value parameter can be negative or positive. |
T:System.ArgumentOutOfRangeException | The resulting T:System.DateTime is less than F:System.DateTime.MinValue or greater than F:System.DateTime.MaxValue. |
Definition at line 768 of file DateTime.cs.
DateTime System.DateTime.AddMonths | ( | int | months | ) |
Returns a new T:System.DateTime that adds the specified number of months to the value of this instance.
months | A number of months. The months parameter can be negative or positive. |
T:System.ArgumentOutOfRangeException | The resulting T:System.DateTime is less than F:System.DateTime.MinValue or greater than F:System.DateTime.MaxValue.-or- months is less than -120,000 or greater than 120,000. |
Definition at line 779 of file DateTime.cs.
DateTime System.DateTime.AddSeconds | ( | double | value | ) |
Returns a new T:System.DateTime that adds the specified number of seconds to the value of this instance.
value | A number of whole and fractional seconds. The value parameter can be negative or positive. |
T:System.ArgumentOutOfRangeException | The resulting T:System.DateTime is less than F:System.DateTime.MinValue or greater than F:System.DateTime.MaxValue. |
Definition at line 816 of file DateTime.cs.
DateTime System.DateTime.AddTicks | ( | long | value | ) |
Returns a new T:System.DateTime that adds the specified number of ticks to the value of this instance.
value | A number of 100-nanosecond ticks. The value parameter can be positive or negative. |
T:System.ArgumentOutOfRangeException | The resulting T:System.DateTime is less than F:System.DateTime.MinValue or greater than F:System.DateTime.MaxValue. |
Definition at line 826 of file DateTime.cs.
DateTime System.DateTime.AddYears | ( | int | value | ) |
Returns a new T:System.DateTime that adds the specified number of years to the value of this instance.
value | A number of years. The value parameter can be negative or positive. |
T:System.ArgumentOutOfRangeException | value or the resulting T:System.DateTime is less than F:System.DateTime.MinValue or greater than F:System.DateTime.MaxValue. |
Definition at line 842 of file DateTime.cs.
Compares two instances of T:System.DateTime and returns an integer that indicates whether the first instance is earlier than, the same as, or later than the second instance.
t1 | The first object to compare. |
t2 | The second object to compare. |
Definition at line 859 of file DateTime.cs.
int System.DateTime.CompareTo | ( | object | value | ) |
Compares the value of this instance to a specified object that contains a specified T:System.DateTime value, and returns an integer that indicates whether this instance is earlier than, the same as, or later than the specified T:System.DateTime value.
value | A boxed object to compare, or null . |
null
. T:System.ArgumentException | value is not a T:System.DateTime. |
Definition at line 879 of file DateTime.cs.
int System.DateTime.CompareTo | ( | DateTime | value | ) |
Compares the value of this instance to a specified T:System.DateTime value and returns an integer that indicates whether this instance is earlier than, the same as, or later than the specified T:System.DateTime value.
value | The object to compare to the current instance. |
Definition at line 906 of file DateTime.cs.
|
static |
Returns the number of days in the specified month and year.
year | The year. |
month | The month (a number ranging from 1 to 12). |
T:System.ArgumentOutOfRangeException | month is less than 1 or greater than 12.-or- year is less than 1 or greater than 9999. |
Definition at line 953 of file DateTime.cs.
override bool System.DateTime.Equals | ( | object | value | ) |
Returns a value indicating whether this instance is equal to a specified object.
value | The object to compare to this instance. |
true
if value is an instance of T:System.DateTime and equals the value of this instance; otherwise, false
.Definition at line 999 of file DateTime.cs.
bool System.DateTime.Equals | ( | DateTime | value | ) |
Returns a value indicating whether the value of this instance is equal to the value of the specified T:System.DateTime instance.
value | The object to compare to this instance. |
true
if the value parameter equals the value of this instance; otherwise, false
.Definition at line 1014 of file DateTime.cs.
Returns a value indicating whether two T:System.DateTime instances have the same date and time value.
t1 | The first object to compare. |
t2 | The second object to compare. |
true
if the two values are equal; otherwise, false
.Definition at line 1026 of file DateTime.cs.
|
static |
Deserializes a 64-bit binary value and recreates an original serialized T:System.DateTime object.
dateData | A 64-bit signed integer that encodes the P:System.DateTime.Kind property in a 2-bit field and the P:System.DateTime.Ticks property in a 62-bit field. |
T:System.ArgumentException | dateData is less than F:System.DateTime.MinValue or greater than F:System.DateTime.MaxValue. |
Definition at line 1037 of file DateTime.cs.
|
static |
Converts the specified Windows file time to an equivalent local time.
fileTime | A Windows file time expressed in ticks. |
T:System.ArgumentOutOfRangeException | fileTime is less than 0 or represents a time greater than F:System.DateTime.MaxValue. |
Definition at line 1092 of file DateTime.cs.
|
static |
Converts the specified Windows file time to an equivalent UTC time.
fileTime | A Windows file time expressed in ticks. |
T:System.ArgumentOutOfRangeException | fileTime is less than 0 or represents a time greater than F:System.DateTime.MaxValue. |
Definition at line 1103 of file DateTime.cs.
|
static |
Returns a T:System.DateTime equivalent to the specified OLE Automation Date.
d | An OLE Automation Date value. |
T:System.ArgumentException | The date is not a valid OLE Automation Date value. |
Definition at line 1118 of file DateTime.cs.
string [] System.DateTime.GetDateTimeFormats | ( | ) |
Converts the value of this instance to all the string representations supported by the standard date and time format specifiers.
Definition at line 1753 of file DateTime.cs.
string [] System.DateTime.GetDateTimeFormats | ( | IFormatProvider | provider | ) |
Converts the value of this instance to all the string representations supported by the standard date and time format specifiers and the specified culture-specific formatting information.
provider | An object that supplies culture-specific formatting information about this instance. |
Definition at line 1762 of file DateTime.cs.
string [] System.DateTime.GetDateTimeFormats | ( | char | format | ) |
Converts the value of this instance to all the string representations supported by the specified standard date and time format specifier.
format | A standard date and time format string (see Remarks). |
T:System.FormatException | format is not a valid standard date and time format specifier character. |
Definition at line 1773 of file DateTime.cs.
string [] System.DateTime.GetDateTimeFormats | ( | char | format, |
IFormatProvider | provider | ||
) |
Converts the value of this instance to all the string representations supported by the specified standard date and time format specifier and culture-specific formatting information.
format | A date and time format string (see Remarks). |
provider | An object that supplies culture-specific formatting information about this instance. |
T:System.FormatException | format is not a valid standard date and time format specifier character. |
Definition at line 1785 of file DateTime.cs.
override int System.DateTime.GetHashCode | ( | ) |
Returns the hash code for this instance.
Definition at line 1229 of file DateTime.cs.
void ISerializable. System.DateTime.GetObjectData | ( | SerializationInfo | info, |
StreamingContext | context | ||
) |
Populates a T:System.Runtime.Serialization.SerializationInfo object with the data needed to serialize the current T:System.DateTime object.
info | The object to populate with data. |
context | The destination for this serialization. (This parameter is not used; specify null .) |
T:System.ArgumentNullException | info is null . |
Implements System.Runtime.Serialization.ISerializable.
Definition at line 1129 of file DateTime.cs.
TypeCode System.DateTime.GetTypeCode | ( | ) |
Returns the T:System.TypeCode for value type T:System.DateTime.
Implements System.IConvertible.
Definition at line 1792 of file DateTime.cs.
bool System.DateTime.IsDaylightSavingTime | ( | ) |
Indicates whether this instance of T:System.DateTime is within the daylight saving time range for the current time zone.
true
if the value of the P:System.DateTime.Kind property is F:System.DateTimeKind.Local or F:System.DateTimeKind.Unspecified and the value of this instance of T:System.DateTime is within the daylight saving time range for the local time zone; false
if P:System.DateTime.Kind is F:System.DateTimeKind.Utc.Definition at line 1143 of file DateTime.cs.
|
static |
Returns an indication whether the specified year is a leap year.
year | A 4-digit year. |
true
if year is a leap year; otherwise, false
.T:System.ArgumentOutOfRangeException | year is less than 1 or greater than 9999. |
Definition at line 1251 of file DateTime.cs.
Determines whether two specified instances of T:System.DateTime are not equal.
d1 | The first object to compare. |
d2 | The second object to compare. |
true
if d1 and d2 do not represent the same date and time; otherwise, false
.Definition at line 1701 of file DateTime.cs.
Subtracts a specified time interval from a specified date and time and returns a new date and time.
d | The date and time value to subtract from. |
t | The time interval to subtract. |
T:System.ArgumentOutOfRangeException | The resulting T:System.DateTime is less than F:System.DateTime.MinValue or greater than F:System.DateTime.MaxValue. |
Definition at line 1663 of file DateTime.cs.
Subtracts a specified date and time from another specified date and time and returns a time interval.
d1 | The date and time value to subtract from (the minuend). |
d2 | The date and time value to subtract (the subtrahend). |
Definition at line 1679 of file DateTime.cs.
Determines whether one specified T:System.DateTime is later than another specified T:System.DateTime.
t1 | The first object to compare. |
t2 | The second object to compare. |
true
if t1 is later than t2 ; otherwise, false
.Definition at line 1734 of file DateTime.cs.
Determines whether one specified T:System.DateTime represents a date and time that is the same as or later than another specified T:System.DateTime.
t1 | The first object to compare. |
t2 | The second object to compare. |
true
if t1 is the same as or later than t2 ; otherwise, false
.Definition at line 1745 of file DateTime.cs.
Adds a specified time interval to a specified date and time, yielding a new date and time.
d | The date and time value to add. |
t | The time interval to add. |
T:System.ArgumentOutOfRangeException | The resulting T:System.DateTime is less than F:System.DateTime.MinValue or greater than F:System.DateTime.MaxValue. |
Definition at line 1646 of file DateTime.cs.
Determines whether one specified T:System.DateTime is earlier than another specified T:System.DateTime.
t1 | The first object to compare. |
t2 | The second object to compare. |
true
if t1 is earlier than t2 ; otherwise, false
.Definition at line 1712 of file DateTime.cs.
Determines whether one specified T:System.DateTime represents a date and time that is the same as or earlier than another specified T:System.DateTime.
t1 | The first object to compare. |
t2 | The second object to compare. |
true
if t1 is the same as or earlier than t2 ; otherwise, false
.Definition at line 1723 of file DateTime.cs.
Determines whether two specified instances of T:System.DateTime are equal.
d1 | The first object to compare. |
d2 | The second object to compare. |
true
if d1 and d2 represent the same date and time; otherwise, false
.Definition at line 1690 of file DateTime.cs.
|
static |
Converts the string representation of a date and time to its T:System.DateTime equivalent.
s | A string that contains a date and time to convert. |
T:System.ArgumentNullException | s is null . |
T:System.FormatException | s does not contain a valid string representation of a date and time. |
Definition at line 1276 of file DateTime.cs.
|
static |
Converts the string representation of a date and time to its T:System.DateTime equivalent by using culture-specific format information.
s | A string that contains a date and time to convert. |
provider | An object that supplies culture-specific format information about s . |
T:System.ArgumentNullException | s is null . |
T:System.FormatException | s does not contain a valid string representation of a date and time. |
Definition at line 1290 of file DateTime.cs.
|
static |
Converts the string representation of a date and time to its T:System.DateTime equivalent by using culture-specific format information and formatting style.
s | A string that contains a date and time to convert. |
provider | An object that supplies culture-specific formatting information about s . |
styles | A bitwise combination of the enumeration values that indicates the style elements that can be present in s for the parse operation to succeed, and that defines how to interpret the parsed date in relation to the current time zone or the current date. A typical value to specify is F:System.Globalization.DateTimeStyles.None. |
T:System.ArgumentNullException | s is null . |
T:System.FormatException | s does not contain a valid string representation of a date and time. |
T:System.ArgumentException | styles contains an invalid combination of T:System.Globalization.DateTimeStyles values. For example, both F:System.Globalization.DateTimeStyles.AssumeLocal and F:System.Globalization.DateTimeStyles.AssumeUniversal. |
Definition at line 1307 of file DateTime.cs.
|
static |
Converts the specified string representation of a date and time to its T:System.DateTime equivalent using the specified format and culture-specific format information. The format of the string representation must match the specified format exactly.
s | A string that contains a date and time to convert. |
format | A format specifier that defines the required format of s . For more information, see the Remarks section. |
provider | An object that supplies culture-specific format information about s . |
T:System.ArgumentNullException | s or format is null . |
T:System.FormatException | s or format is an empty string. -or- s does not contain a date and time that corresponds to the pattern specified in format . -or- The hour component and the AM/PM designator in s do not agree. |
Definition at line 1325 of file DateTime.cs.
|
static |
Converts the specified string representation of a date and time to its T:System.DateTime equivalent using the specified format, culture-specific format information, and style. The format of the string representation must match the specified format exactly or an exception is thrown.
s | A string containing a date and time to convert. |
format | A format specifier that defines the required format of s . For more information, see the Remarks section. |
provider | An object that supplies culture-specific formatting information about s . |
style | A bitwise combination of the enumeration values that provides additional information about s , about style elements that may be present in s , or about the conversion from s to a T:System.DateTime value. A typical value to specify is F:System.Globalization.DateTimeStyles.None. |
T:System.ArgumentNullException | s or format is null . |
T:System.FormatException | s or format is an empty string. -or- s does not contain a date and time that corresponds to the pattern specified in format . -or- The hour component and the AM/PM designator in s do not agree. |
T:System.ArgumentException | style contains an invalid combination of T:System.Globalization.DateTimeStyles values. For example, both F:System.Globalization.DateTimeStyles.AssumeLocal and F:System.Globalization.DateTimeStyles.AssumeUniversal. |
Definition at line 1345 of file DateTime.cs.
|
static |
Converts the specified string representation of a date and time to its T:System.DateTime equivalent using the specified array of formats, culture-specific format information, and style. The format of the string representation must match at least one of the specified formats exactly or an exception is thrown.
s | A string that contains a date and time to convert. |
formats | An array of allowable formats of s . For more information, see the Remarks section. |
provider | An object that supplies culture-specific format information about s . |
style | A bitwise combination of enumeration values that indicates the permitted format of s . A typical value to specify is F:System.Globalization.DateTimeStyles.None. |
T:System.ArgumentNullException | s or formats is null . |
T:System.FormatException | s is an empty string. -or- an element of formats is an empty string. -or- s does not contain a date and time that corresponds to any element of formats . -or- The hour component and the AM/PM designator in s do not agree. |
T:System.ArgumentException | style contains an invalid combination of T:System.Globalization.DateTimeStyles values. For example, both F:System.Globalization.DateTimeStyles.AssumeLocal and F:System.Globalization.DateTimeStyles.AssumeUniversal. |
Definition at line 1366 of file DateTime.cs.
|
static |
Creates a new T:System.DateTime object that has the same number of ticks as the specified T:System.DateTime, but is designated as either local time, Coordinated Universal Time (UTC), or neither, as indicated by the specified T:System.DateTimeKind value.
value | A date and time. |
kind | One of the enumeration values that indicates whether the new object represents local time, UTC, or neither. |
Definition at line 1157 of file DateTime.cs.
Subtracts the specified date and time from this instance.
value | The date and time value to subtract. |
T:System.ArgumentOutOfRangeException | The result is less than F:System.DateTime.MinValue or greater than F:System.DateTime.MaxValue. |
Definition at line 1377 of file DateTime.cs.
Subtracts the specified duration from this instance.
value | The time interval to subtract. |
T:System.ArgumentOutOfRangeException | The result is less than F:System.DateTime.MinValue or greater than F:System.DateTime.MaxValue. |
Definition at line 1387 of file DateTime.cs.
long System.DateTime.ToBinary | ( | ) |
Serializes the current T:System.DateTime object to a 64-bit binary value that subsequently can be used to recreate the T:System.DateTime object.
Definition at line 1165 of file DateTime.cs.
bool IConvertible. System.DateTime.ToBoolean | ( | IFormatProvider | provider | ) |
This conversion is not supported. Attempting to use this method throws an T:System.InvalidCastException.
provider | An object that implements the T:System.IFormatProvider interface. (This parameter is not used; specify null .) |
T:System.InvalidCastException | In all cases. |
Implements System.IConvertible.
Definition at line 1802 of file DateTime.cs.
byte IConvertible. System.DateTime.ToByte | ( | IFormatProvider | provider | ) |
This conversion is not supported. Attempting to use this method throws an T:System.InvalidCastException.
provider | An object that implements the T:System.IFormatProvider interface. (This parameter is not used; specify null .) |
T:System.InvalidCastException | In all cases. |
Implements System.IConvertible.
Definition at line 1832 of file DateTime.cs.
char IConvertible. System.DateTime.ToChar | ( | IFormatProvider | provider | ) |
This conversion is not supported. Attempting to use this method throws an T:System.InvalidCastException.
provider | An object that implements the T:System.IFormatProvider interface. (This parameter is not used; specify null .) |
T:System.InvalidCastException | In all cases. |
Implements System.IConvertible.
Definition at line 1812 of file DateTime.cs.
DateTime IConvertible. System.DateTime.ToDateTime | ( | IFormatProvider | provider | ) |
Returns the current T:System.DateTime object.
provider | An object that implements the T:System.IFormatProvider interface. (This parameter is not used; specify null .) |
Implements System.IConvertible.
Definition at line 1931 of file DateTime.cs.
decimal IConvertible. System.DateTime.ToDecimal | ( | IFormatProvider | provider | ) |
This conversion is not supported. Attempting to use this method throws an T:System.InvalidCastException.
provider | An object that implements the T:System.IFormatProvider interface. (This parameter is not used; specify null .) |
T:System.InvalidCastException | In all cases. |
Implements System.IConvertible.
Definition at line 1922 of file DateTime.cs.
double IConvertible. System.DateTime.ToDouble | ( | IFormatProvider | provider | ) |
This conversion is not supported. Attempting to use this method throws an T:System.InvalidCastException.
provider | An object that implements the T:System.IFormatProvider interface. (This parameter is not used; specify null .) |
T:System.InvalidCastException | In all cases. |
Implements System.IConvertible.
Definition at line 1912 of file DateTime.cs.
long System.DateTime.ToFileTime | ( | ) |
Converts the value of the current T:System.DateTime object to a Windows file time.
T:System.ArgumentOutOfRangeException | The resulting file time would represent a date and time before 12:00 midnight January 1, 1601 C.E. UTC. |
Definition at line 1437 of file DateTime.cs.
long System.DateTime.ToFileTimeUtc | ( | ) |
Converts the value of the current T:System.DateTime object to a Windows file time.
T:System.ArgumentOutOfRangeException | The resulting file time would represent a date and time before 12:00 midnight January 1, 1601 C.E. UTC. |
Definition at line 1446 of file DateTime.cs.
short IConvertible. System.DateTime.ToInt16 | ( | IFormatProvider | provider | ) |
This conversion is not supported. Attempting to use this method throws an T:System.InvalidCastException.
provider | An object that implements the T:System.IFormatProvider interface. (This parameter is not used; specify null .) |
T:System.InvalidCastException | In all cases. |
Implements System.IConvertible.
Definition at line 1842 of file DateTime.cs.
int IConvertible. System.DateTime.ToInt32 | ( | IFormatProvider | provider | ) |
This conversion is not supported. Attempting to use this method throws an T:System.InvalidCastException.
provider | An object that implements the T:System.IFormatProvider interface. (This parameter is not used; specify null .) |
T:System.InvalidCastException | In all cases. |
Implements System.IConvertible.
Definition at line 1862 of file DateTime.cs.
long IConvertible. System.DateTime.ToInt64 | ( | IFormatProvider | provider | ) |
This conversion is not supported. Attempting to use this method throws an T:System.InvalidCastException.
provider | An object that implements the T:System.IFormatProvider interface. (This parameter is not used; specify null .) |
T:System.InvalidCastException | In all cases. |
Implements System.IConvertible.
Definition at line 1882 of file DateTime.cs.
DateTime System.DateTime.ToLocalTime | ( | ) |
Converts the value of the current T:System.DateTime object to local time.
Definition at line 1460 of file DateTime.cs.
string System.DateTime.ToLongDateString | ( | ) |
Converts the value of the current T:System.DateTime object to its equivalent long date string representation.
Definition at line 1496 of file DateTime.cs.
string System.DateTime.ToLongTimeString | ( | ) |
Converts the value of the current T:System.DateTime object to its equivalent long time string representation.
Definition at line 1503 of file DateTime.cs.
double System.DateTime.ToOADate | ( | ) |
Converts the value of this instance to the equivalent OLE Automation date.
T:System.OverflowException | The value of this instance cannot be represented as an OLE Automation Date. |
Definition at line 1428 of file DateTime.cs.
sbyte IConvertible. System.DateTime.ToSByte | ( | IFormatProvider | provider | ) |
This conversion is not supported. Attempting to use this method throws an T:System.InvalidCastException.
provider | An object that implements the T:System.IFormatProvider interface. (This parameter is not used; specify null .) |
T:System.InvalidCastException | In all cases. |
Implements System.IConvertible.
Definition at line 1822 of file DateTime.cs.
string System.DateTime.ToShortDateString | ( | ) |
Converts the value of the current T:System.DateTime object to its equivalent short date string representation.
Definition at line 1510 of file DateTime.cs.
string System.DateTime.ToShortTimeString | ( | ) |
Converts the value of the current T:System.DateTime object to its equivalent short time string representation.
Definition at line 1517 of file DateTime.cs.
float IConvertible. System.DateTime.ToSingle | ( | IFormatProvider | provider | ) |
This conversion is not supported. Attempting to use this method throws an T:System.InvalidCastException.
provider | An object that implements the T:System.IFormatProvider interface. (This parameter is not used; specify null .) |
T:System.InvalidCastException | In all cases. |
Implements System.IConvertible.
Definition at line 1902 of file DateTime.cs.
override string System.DateTime.ToString | ( | ) |
Converts the value of the current T:System.DateTime object to its equivalent string representation using the formatting conventions of the current culture.
T:System.ArgumentOutOfRangeException | The date and time is outside the range of dates supported by the calendar used by the current culture. |
Definition at line 1526 of file DateTime.cs.
string System.DateTime.ToString | ( | string | format | ) |
Converts the value of the current T:System.DateTime object to its equivalent string representation using the specified format and the formatting conventions of the current culture.
format | A standard or custom date and time format string (see Remarks). |
T:System.FormatException | The length of format is 1, and it is not one of the format specifier characters defined for T:System.Globalization.DateTimeFormatInfo.-or- format does not contain a valid custom format pattern. |
T:System.ArgumentOutOfRangeException | The date and time is outside the range of dates supported by the calendar used by the current culture. |
Definition at line 1538 of file DateTime.cs.
string System.DateTime.ToString | ( | IFormatProvider | provider | ) |
Converts the value of the current T:System.DateTime object to its equivalent string representation using the specified culture-specific format information.
provider | An object that supplies culture-specific formatting information. |
T:System.ArgumentOutOfRangeException | The date and time is outside the range of dates supported by the calendar used by provider . |
Implements System.IConvertible.
Definition at line 1548 of file DateTime.cs.
string System.DateTime.ToString | ( | string | format, |
IFormatProvider | provider | ||
) |
Converts the value of the current T:System.DateTime object to its equivalent string representation using the specified format and culture-specific format information.
format | A standard or custom date and time format string. |
provider | An object that supplies culture-specific formatting information. |
T:System.FormatException | The length of format is 1, and it is not one of the format specifier characters defined for T:System.Globalization.DateTimeFormatInfo.-or- format does not contain a valid custom format pattern. |
T:System.ArgumentOutOfRangeException | The date and time is outside the range of dates supported by the calendar used by provider . |
Implements System.IFormattable.
Definition at line 1561 of file DateTime.cs.
object IConvertible. System.DateTime.ToType | ( | Type | type, |
IFormatProvider | provider | ||
) |
Converts the current T:System.DateTime object to an object of a specified type.
type | The desired type. |
provider | An object that implements the T:System.IFormatProvider interface. (This parameter is not used; specify null .) |
T:System.ArgumentNullException | type is null . |
T:System.InvalidCastException | This conversion is not supported for the T:System.DateTime type. |
Implements System.IConvertible.
Definition at line 1944 of file DateTime.cs.
ushort IConvertible. System.DateTime.ToUInt16 | ( | IFormatProvider | provider | ) |
This conversion is not supported. Attempting to use this method throws an T:System.InvalidCastException.
provider | An object that implements the T:System.IFormatProvider interface. (This parameter is not used; specify null .) |
T:System.InvalidCastException | In all cases. |
Implements System.IConvertible.
Definition at line 1852 of file DateTime.cs.
uint IConvertible. System.DateTime.ToUInt32 | ( | IFormatProvider | provider | ) |
This conversion is not supported. Attempting to use this method throws an T:System.InvalidCastException.
provider | An object that implements the T:System.IFormatProvider interface. (This parameter is not used; specify null .) |
T:System.InvalidCastException | In all cases. |
Implements System.IConvertible.
Definition at line 1872 of file DateTime.cs.
ulong IConvertible. System.DateTime.ToUInt64 | ( | IFormatProvider | provider | ) |
This conversion is not supported. Attempting to use this method throws an T:System.InvalidCastException.
provider | An object that implements the T:System.IFormatProvider interface. (This parameter is not used; specify null .) |
T:System.InvalidCastException | In all cases. |
Implements System.IConvertible.
Definition at line 1892 of file DateTime.cs.
DateTime System.DateTime.ToUniversalTime | ( | ) |
Converts the value of the current T:System.DateTime object to Coordinated Universal Time (UTC).
Definition at line 1569 of file DateTime.cs.
|
static |
Converts the specified string representation of a date and time to its T:System.DateTime equivalent and returns a value that indicates whether the conversion succeeded.
s | A string containing a date and time to convert. |
result | When this method returns, contains the T:System.DateTime value equivalent to the date and time contained in s , if the conversion succeeded, or F:System.DateTime.MinValue if the conversion failed. The conversion fails if the s parameter is null , is an empty string (""), or does not contain a valid string representation of a date and time. This parameter is passed uninitialized. |
true
if the s parameter was converted successfully; otherwise, false
.Definition at line 1580 of file DateTime.cs.
|
static |
Converts the specified string representation of a date and time to its T:System.DateTime equivalent using the specified culture-specific format information and formatting style, and returns a value that indicates whether the conversion succeeded.
s | A string containing a date and time to convert. |
provider | An object that supplies culture-specific formatting information about s . |
styles | A bitwise combination of enumeration values that defines how to interpret the parsed date in relation to the current time zone or the current date. A typical value to specify is F:System.Globalization.DateTimeStyles.None. |
result | When this method returns, contains the T:System.DateTime value equivalent to the date and time contained in s , if the conversion succeeded, or F:System.DateTime.MinValue if the conversion failed. The conversion fails if the s parameter is null , is an empty string (""), or does not contain a valid string representation of a date and time. This parameter is passed uninitialized. |
true
if the s parameter was converted successfully; otherwise, false
.T:System.ArgumentException | styles is not a valid T:System.Globalization.DateTimeStyles value.-or- styles contains an invalid combination of T:System.Globalization.DateTimeStyles values (for example, both F:System.Globalization.DateTimeStyles.AssumeLocal and F:System.Globalization.DateTimeStyles.AssumeUniversal). |
T:System.NotSupportedException | provider is a neutral culture and cannot be used in a parsing operation. |
Definition at line 1598 of file DateTime.cs.
|
static |
Converts the specified string representation of a date and time to its T:System.DateTime equivalent using the specified format, culture-specific format information, and style. The format of the string representation must match the specified format exactly. The method returns a value that indicates whether the conversion succeeded.
s | A string containing a date and time to convert. |
format | The required format of s . See the Remarks section for more information. |
provider | An object that supplies culture-specific formatting information about s . |
style | A bitwise combination of one or more enumeration values that indicate the permitted format of s . |
result | When this method returns, contains the T:System.DateTime value equivalent to the date and time contained in s , if the conversion succeeded, or F:System.DateTime.MinValue if the conversion failed. The conversion fails if either the s or format parameter is null , is an empty string, or does not contain a date and time that correspond to the pattern specified in format . This parameter is passed uninitialized. |
true
if s was converted successfully; otherwise, false
.T:System.ArgumentException | styles is not a valid T:System.Globalization.DateTimeStyles value.-or- styles contains an invalid combination of T:System.Globalization.DateTimeStyles values (for example, both F:System.Globalization.DateTimeStyles.AssumeLocal and F:System.Globalization.DateTimeStyles.AssumeUniversal). |
Definition at line 1616 of file DateTime.cs.
|
static |
Converts the specified string representation of a date and time to its T:System.DateTime equivalent using the specified array of formats, culture-specific format information, and style. The format of the string representation must match at least one of the specified formats exactly. The method returns a value that indicates whether the conversion succeeded.
s | A string that contains a date and time to convert. |
formats | An array of allowable formats of s . See the Remarks section for more information. |
provider | An object that supplies culture-specific format information about s . |
style | A bitwise combination of enumeration values that indicates the permitted format of s . A typical value to specify is F:System.Globalization.DateTimeStyles.None. |
result | When this method returns, contains the T:System.DateTime value equivalent to the date and time contained in s , if the conversion succeeded, or F:System.DateTime.MinValue if the conversion failed. The conversion fails if s or formats is null , s or an element of formats is an empty string, or the format of s is not exactly as specified by at least one of the format patterns in formats . This parameter is passed uninitialized. |
true
if the s parameter was converted successfully; otherwise, false
.T:System.ArgumentException | styles is not a valid T:System.Globalization.DateTimeStyles value.-or- styles contains an invalid combination of T:System.Globalization.DateTimeStyles values (for example, both F:System.Globalization.DateTimeStyles.AssumeLocal and F:System.Globalization.DateTimeStyles.AssumeUniversal). |
Definition at line 1634 of file DateTime.cs.
|
static |
Represents the largest possible value of T:System.DateTime. This field is read-only.
Definition at line 113 of file DateTime.cs.
Represents the smallest possible value of T:System.DateTime. This field is read-only.
Definition at line 109 of file DateTime.cs.
|
get |
Gets the date component of this instance.
Definition at line 147 of file DateTime.cs.
|
get |
Gets the day of the month represented by this instance.
Definition at line 160 of file DateTime.cs.
|
get |
Gets the day of the week represented by this instance.
Definition at line 172 of file DateTime.cs.
|
get |
Gets the day of the year represented by this instance.
Definition at line 184 of file DateTime.cs.
|
get |
Gets the hour component of the date represented by this instance.
Definition at line 196 of file DateTime.cs.
|
get |
Gets a value that indicates whether the time represented by this instance is based on local time, Coordinated Universal Time (UTC), or neither.
Definition at line 208 of file DateTime.cs.
|
get |
Gets the milliseconds component of the date represented by this instance.
Definition at line 228 of file DateTime.cs.
|
get |
Gets the minute component of the date represented by this instance.
Definition at line 240 of file DateTime.cs.
|
get |
Gets the month component of the date represented by this instance.
Definition at line 252 of file DateTime.cs.
|
staticget |
Gets a T:System.DateTime object that is set to the current date and time on this computer, expressed as the local time.
Definition at line 264 of file DateTime.cs.
|
get |
Gets the seconds component of the date represented by this instance.
Definition at line 303 of file DateTime.cs.
|
get |
Gets the number of ticks that represent the date and time of this instance.
DateTime.MinValue.Ticks
and DateTime.MaxValue.Ticks
.Definition at line 315 of file DateTime.cs.
|
get |
Gets the time of day for this instance.
Definition at line 327 of file DateTime.cs.
|
staticget |
Gets the current date.
Definition at line 339 of file DateTime.cs.
|
staticget |
Gets a T:System.DateTime object that is set to the current date and time on this computer, expressed as the Coordinated Universal Time (UTC).
Definition at line 288 of file DateTime.cs.
|
get |
Gets the year component of the date represented by this instance.
Definition at line 351 of file DateTime.cs.