Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

DateTime Methods

The DateTime type exposes the following members.

  Name Description
Public method Supported by the XNA Framework Supported by Portable Class Library Add Returns a new DateTime that adds the value of the specified TimeSpan to the value of this instance.
Public method Supported by the XNA Framework Supported by Portable Class Library AddDays Returns a new DateTime that adds the specified number of days to the value of this instance.
Public method Supported by the XNA Framework Supported by Portable Class Library AddHours Returns a new DateTime that adds the specified number of hours to the value of this instance.
Public method Supported by the XNA Framework Supported by Portable Class Library AddMilliseconds Returns a new DateTime that adds the specified number of milliseconds to the value of this instance.
Public method Supported by the XNA Framework Supported by Portable Class Library AddMinutes Returns a new DateTime that adds the specified number of minutes to the value of this instance.
Public method Supported by the XNA Framework Supported by Portable Class Library AddMonths Returns a new DateTime that adds the specified number of months to the value of this instance.
Public method Supported by the XNA Framework Supported by Portable Class Library AddSeconds Returns a new DateTime that adds the specified number of seconds to the value of this instance.
Public method Supported by the XNA Framework Supported by Portable Class Library AddTicks Returns a new DateTime that adds the specified number of ticks to the value of this instance.
Public method Supported by the XNA Framework Supported by Portable Class Library AddYears Returns a new DateTime that adds the specified number of years to the value of this instance.
Public method Static member Supported by the XNA Framework Supported by Portable Class Library Compare Compares two instances of DateTime and returns an integer that indicates whether the first instance is earlier than, the same as, or later than the second instance.
Public method Supported by the XNA Framework Supported by Portable Class Library CompareTo(DateTime) Compares the value of this instance to a specified DateTime value and returns an integer that indicates whether this instance is earlier than, the same as, or later than the specified DateTime value.
Public method Supported by the XNA Framework CompareTo(Object) Compares the value of this instance to a specified object that contains a specified DateTime value, and returns an integer that indicates whether this instance is earlier than, the same as, or later than the specified DateTime value.
Public method Static member Supported by the XNA Framework Supported by Portable Class Library DaysInMonth Returns the number of days in the specified month and year.
Public method Supported by the XNA Framework Supported by Portable Class Library Equals(DateTime) Returns a value indicating whether the value of this instance is equal to the value of the specified DateTime instance.
Public method Supported by the XNA Framework Supported by Portable Class Library Equals(Object) Returns a value indicating whether this instance is equal to a specified object. (Overrides ValueType.Equals(Object).)
Public method Static member Supported by the XNA Framework Supported by Portable Class Library Equals(DateTime, DateTime) Returns a value indicating whether two DateTime instances have the same date and time value.
Public method Static member Supported by Portable Class Library FromBinary Deserializes a 64-bit binary value and recreates an original serialized DateTime object.
Public method Static member Supported by the XNA Framework Supported by Portable Class Library FromFileTime Converts the specified Windows file time to an equivalent local time.
Public method Static member Supported by the XNA Framework Supported by Portable Class Library FromFileTimeUtc Converts the specified Windows file time to an equivalent UTC time.
Public method Static member Supported by the XNA Framework FromOADate Returns a DateTime equivalent to the specified OLE Automation Date.
Public method Supported by the XNA Framework Supported by Portable Class Library GetDateTimeFormats() Converts the value of this instance to all the string representations supported by the standard date and time format specifiers.
Public method Supported by the XNA Framework Supported by Portable Class Library GetDateTimeFormats(Char) Converts the value of this instance to all the string representations supported by the specified standard date and time format specifier.
Public method Supported by the XNA Framework Supported by Portable Class Library GetDateTimeFormats(IFormatProvider) 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.
Public method Supported by the XNA Framework Supported by Portable Class Library GetDateTimeFormats(Char, IFormatProvider) 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.
Public method Supported by the XNA Framework Supported by Portable Class Library GetHashCode Returns the hash code for this instance. (Overrides ValueType.GetHashCode().)
Public method Supported by the XNA Framework Supported by Portable Class Library GetType Gets the Type of the current instance. (Inherited from Object.)
Public method Supported by the XNA Framework GetTypeCode Returns the TypeCode for value type DateTime.
Public method Supported by the XNA Framework Supported by Portable Class Library IsDaylightSavingTime Indicates whether this instance of DateTime is within the daylight saving time range for the current time zone.
Public method Static member Supported by the XNA Framework Supported by Portable Class Library IsLeapYear Returns an indication whether the specified year is a leap year.
Public method Static member Supported by the XNA Framework Supported by Portable Class Library Parse(String) Converts the string representation of a date and time to its DateTime equivalent.
Public method Static member Supported by the XNA Framework Supported by Portable Class Library Parse(String, IFormatProvider) Converts the string representation of a date and time to its DateTime equivalent by using culture-specific format information.
Public method Static member Supported by the XNA Framework Supported by Portable Class Library Parse(String, IFormatProvider, DateTimeStyles) Converts the string representation of a date and time to its DateTime equivalent by using culture-specific format information and formatting style.
Public method Static member Supported by the XNA Framework Supported by Portable Class Library ParseExact(String, String, IFormatProvider) Converts the specified string representation of a date and time to its DateTime equivalent using the specified format and culture-specific format information. The format of the string representation must match the specified format exactly.
Public method Static member Supported by the XNA Framework Supported by Portable Class Library ParseExact(String, String, IFormatProvider, DateTimeStyles) Converts the specified string representation of a date and time to its 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.
Public method Static member Supported by the XNA Framework Supported by Portable Class Library ParseExact(String, String[], IFormatProvider, DateTimeStyles) Converts the specified string representation of a date and time to its 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.
Public method Static member Supported by the XNA Framework Supported by Portable Class Library SpecifyKind Creates a new DateTime object that has the same number of ticks as the specified DateTime, but is designated as either local time, Coordinated Universal Time (UTC), or neither, as indicated by the specified DateTimeKind value.
Public method Supported by the XNA Framework Supported by Portable Class Library Subtract(DateTime) Subtracts the specified date and time from this instance.
Public method Supported by the XNA Framework Supported by Portable Class Library Subtract(TimeSpan) Subtracts the specified duration from this instance.
Public method Supported by Portable Class Library ToBinary Serializes the current DateTime object to a 64-bit binary value that subsequently can be used to recreate the DateTime object.
Public method Supported by the XNA Framework Supported by Portable Class Library ToFileTime Converts the value of the current DateTime object to a Windows file time.
Public method Supported by the XNA Framework Supported by Portable Class Library ToFileTimeUtc Converts the value of the current DateTime object to a Windows file time.
Public method Supported by the XNA Framework Supported by Portable Class Library ToLocalTime Converts the value of the current DateTime object to local time.
Public method Supported by the XNA Framework ToLongDateString Converts the value of the current DateTime object to its equivalent long date string representation.
Public method Supported by the XNA Framework ToLongTimeString Converts the value of the current DateTime object to its equivalent long time string representation.
Public method Supported by the XNA Framework ToOADate Converts the value of this instance to the equivalent OLE Automation date.
Public method Supported by the XNA Framework ToShortDateString Converts the value of the current DateTime object to its equivalent short date string representation.
Public method Supported by the XNA Framework ToShortTimeString Converts the value of the current DateTime object to its equivalent short time string representation.
Public method Supported by the XNA Framework Supported by Portable Class Library ToString() Converts the value of the current DateTime object to its equivalent string representation. (Overrides ValueType.ToString().)
Public method Supported by the XNA Framework Supported by Portable Class Library ToString(IFormatProvider) Converts the value of the current DateTime object to its equivalent string representation using the specified culture-specific format information.
Public method Supported by the XNA Framework Supported by Portable Class Library ToString(String) Converts the value of the current DateTime object to its equivalent string representation using the specified format.
Public method Supported by the XNA Framework Supported by Portable Class Library 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.
Public method Supported by the XNA Framework Supported by Portable Class Library ToUniversalTime Converts the value of the current DateTime object to Coordinated Universal Time (UTC).
Public method Static member Supported by Portable Class Library 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.
Public method Static member Supported by Portable Class Library 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.
Public method Static member Supported by Portable Class Library TryParseExact(String, String, IFormatProvider, DateTimeStyles, DateTime) Converts the specified string representation of a date and time to its 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.
Public method Static member Supported by Portable Class Library TryParseExact(String, String[], IFormatProvider, DateTimeStyles, DateTime) Converts the specified string representation of a date and time to its 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.
Top

  Name Description
Explicit interface implemetation Private method Supported by Portable Class Library IComparable.CompareTo Compares the current instance with another object of the same type and returns an integer that indicates whether this instance precedes, follows, or occurs in the same position in the sort order as the other object.
Explicit interface implemetation Private method Supported by the XNA Framework IConvertible.ToBoolean Infrastructure. This conversion is not supported. Attempting to use this method throws an InvalidCastException.
Explicit interface implemetation Private method Supported by the XNA Framework IConvertible.ToByte Infrastructure. This conversion is not supported. Attempting to use this method throws an InvalidCastException.
Explicit interface implemetation Private method Supported by the XNA Framework IConvertible.ToChar Infrastructure. This conversion is not supported. Attempting to use this method throws an InvalidCastException.
Explicit interface implemetation Private method Supported by the XNA Framework IConvertible.ToDateTime Infrastructure. Returns the current DateTime object.
Explicit interface implemetation Private method Supported by the XNA Framework IConvertible.ToDecimal Infrastructure. This conversion is not supported. Attempting to use this method throws an InvalidCastException.
Explicit interface implemetation Private method Supported by the XNA Framework IConvertible.ToDouble Infrastructure. This conversion is not supported. Attempting to use this method throws an InvalidCastException.
Explicit interface implemetation Private method Supported by the XNA Framework IConvertible.ToInt16 Infrastructure. This conversion is not supported. Attempting to use this method throws an InvalidCastException.
Explicit interface implemetation Private method Supported by the XNA Framework IConvertible.ToInt32 Infrastructure. This conversion is not supported. Attempting to use this method throws an InvalidCastException.
Explicit interface implemetation Private method Supported by the XNA Framework IConvertible.ToInt64 Infrastructure. This conversion is not supported. Attempting to use this method throws an InvalidCastException.
Explicit interface implemetation Private method Supported by the XNA Framework IConvertible.ToSByte Infrastructure. This conversion is not supported. Attempting to use this method throws an InvalidCastException.
Explicit interface implemetation Private method Supported by the XNA Framework IConvertible.ToSingle Infrastructure. This conversion is not supported. Attempting to use this method throws an InvalidCastException.
Explicit interface implemetation Private method Supported by the XNA Framework IConvertible.ToType Infrastructure. Converts the current DateTime object to an object of a specified type.
Explicit interface implemetation Private method Supported by the XNA Framework IConvertible.ToUInt16 Infrastructure. This conversion is not supported. Attempting to use this method throws an InvalidCastException.
Explicit interface implemetation Private method Supported by the XNA Framework IConvertible.ToUInt32 Infrastructure. This conversion is not supported. Attempting to use this method throws an InvalidCastException.
Explicit interface implemetation Private method Supported by the XNA Framework IConvertible.ToUInt64 Infrastructure. This conversion is not supported. Attempting to use this method throws an InvalidCastException.
Explicit interface implemetation Private method ISerializable.GetObjectData Populates a SerializationInfo object with the data needed to serialize the current DateTime object.
Top
Show:
© 2015 Microsoft