DateTime Methods

Microsoft Silverlight will reach end of support after October 2021. Learn more.

Include Protected Members
Include Inherited Members

Include Silverlight Members
Include Silverlight for Windows Phone Members
Include XNA Framework Members

The DateTime type exposes the following members.

Methods

  Name Description
Public methodSupported by Silverlight for Windows PhoneSupported by Xbox 360 Add Returns a new DateTime that adds the value of the specified TimeSpan to the value of this instance.
Public methodSupported by Silverlight for Windows PhoneSupported by Xbox 360 AddDays Returns a new DateTime that adds the specified number of days to the value of this instance.
Public methodSupported by Silverlight for Windows PhoneSupported by Xbox 360 AddHours Returns a new DateTime that adds the specified number of hours to the value of this instance.
Public methodSupported by Silverlight for Windows PhoneSupported by Xbox 360 AddMilliseconds Returns a new DateTime that adds the specified number of milliseconds to the value of this instance.
Public methodSupported by Silverlight for Windows PhoneSupported by Xbox 360 AddMinutes Returns a new DateTime that adds the specified number of minutes to the value of this instance.
Public methodSupported by Silverlight for Windows PhoneSupported by Xbox 360 AddMonths Returns a new DateTime that adds the specified number of months to the value of this instance.
Public methodSupported by Silverlight for Windows PhoneSupported by Xbox 360 AddSeconds Returns a new DateTime that adds the specified number of seconds to the value of this instance.
Public methodSupported by Silverlight for Windows PhoneSupported by Xbox 360 AddTicks Returns a new DateTime that adds the specified number of ticks to the value of this instance.
Public methodSupported by Silverlight for Windows PhoneSupported by Xbox 360 AddYears Returns a new DateTime that adds the specified number of years to the value of this instance.
Public methodStatic memberSupported by Silverlight for Windows PhoneSupported by Xbox 360 Compare Compares two instances of DateTime and returns an integer that indicates whether the first DateTime instance is earlier than, the same as, or later than the second DateTime instance.
Public methodSupported by Silverlight for Windows PhoneSupported by Xbox 360 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 methodSupported by Silverlight for Windows PhoneSupported by Xbox 360 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 methodStatic memberSupported by Silverlight for Windows PhoneSupported by Xbox 360 DaysInMonth Returns the number of days in the specified month and year.
Public methodSupported by Silverlight for Windows PhoneSupported by Xbox 360 Equals(DateTime) Returns a value indicating whether the value of this instance is equal to the value of the specified DateTime instance.
Public methodSupported by Silverlight for Windows PhoneSupported by Xbox 360 Equals(Object) Returns a value indicating whether this instance is equal to a specified object. (Overrides ValueType.Equals(Object).)
Public methodStatic memberSupported by Silverlight for Windows PhoneSupported by Xbox 360 Equals(DateTime, DateTime) Returns a value indicating whether two DateTime instances have the same date and time value.
Protected methodSupported by Silverlight for Windows PhoneSupported by Xbox 360 Finalize Allows an object to try to free resources and perform other cleanup operations before the Object is reclaimed by garbage collection. (Inherited from Object.)
Public methodStatic member FromBinary Deserializes a 64-bit binary value and recreates an original serialized DateTime object.
Public methodStatic memberSupported by Silverlight for Windows PhoneSupported by Xbox 360 FromFileTime Converts the specified Windows file time to an equivalent local time.
Public methodStatic memberSupported by Silverlight for Windows PhoneSupported by Xbox 360 FromFileTimeUtc Converts the specified Windows file time to an equivalent UTC time.
Public methodStatic memberSupported by Silverlight for Windows PhoneSupported by Xbox 360 FromOADate Returns a DateTime equivalent to the specified OLE Automation date.
Public methodSupported by Silverlight for Windows PhoneSupported by Xbox 360 GetHashCode Returns the hash code for this instance. (Overrides ValueType.GetHashCode().)
Public methodSupported by Silverlight for Windows PhoneSupported by Xbox 360 GetType Gets the Type of the current instance. (Inherited from Object.)
Public methodSupported by Silverlight for Windows PhoneSupported by Xbox 360 GetTypeCode Returns the TypeCode for value type DateTime.
Public methodSupported by Silverlight for Windows PhoneSupported by Xbox 360 IsDaylightSavingTime Indicates whether this instance of DateTime is within the Daylight Saving Time range for the current time zone.
Public methodStatic memberSupported by Silverlight for Windows PhoneSupported by Xbox 360 IsLeapYear Returns an indication whether the specified year is a leap year.
Protected methodSupported by Silverlight for Windows PhoneSupported by Xbox 360 MemberwiseClone Creates a shallow copy of the current Object. (Inherited from Object.)
Public methodStatic memberSupported by Silverlight for Windows PhoneSupported by Xbox 360 Parse(String) Converts the specified string representation of a date and time to its DateTime equivalent.
Public methodStatic memberSupported by Silverlight for Windows PhoneSupported by Xbox 360 Parse(String, IFormatProvider) Converts the specified string representation of a date and time to its DateTime equivalent using the specified culture-specific format information.
Public methodStatic memberSupported by Silverlight for Windows PhoneSupported by Xbox 360 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.
Public methodStatic memberSupported by Silverlight for Windows PhoneSupported by Xbox 360 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 methodStatic memberSupported by Silverlight for Windows PhoneSupported by Xbox 360 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 methodStatic memberSupported by Silverlight for Windows PhoneSupported by Xbox 360 ParseExact(String, array<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 methodStatic memberSupported by Silverlight for Windows PhoneSupported by Xbox 360 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 methodSupported by Silverlight for Windows PhoneSupported by Xbox 360 Subtract(DateTime) Subtracts the specified date and time from this instance.
Public methodSupported by Silverlight for Windows PhoneSupported by Xbox 360 Subtract(TimeSpan) Subtracts the specified duration from this instance.
Public methodSupported by Silverlight for Windows PhoneSupported by Xbox 360 ToFileTime Converts the value of the current DateTime object to a Windows file time.
Public methodSupported by Silverlight for Windows PhoneSupported by Xbox 360 ToFileTimeUtc Converts the value of the current DateTime object to a Windows file time.
Public methodSupported by Silverlight for Windows PhoneSupported by Xbox 360 ToLocalTime Converts the value of the current DateTime object to local time.
Public methodSupported by Silverlight for Windows PhoneSupported by Xbox 360 ToLongDateString Converts the value of the current DateTime object to its equivalent long date string representation.
Public methodSupported by Silverlight for Windows PhoneSupported by Xbox 360 ToLongTimeString Converts the value of the current DateTime object to its equivalent long time string representation.
Public methodSupported by Silverlight for Windows PhoneSupported by Xbox 360 ToOADate Converts the value of this instance to the equivalent OLE Automation date.
Public methodSupported by Silverlight for Windows PhoneSupported by Xbox 360 ToShortDateString Converts the value of the current DateTime object to its equivalent short date string representation.
Public methodSupported by Silverlight for Windows PhoneSupported by Xbox 360 ToShortTimeString Converts the value of the current DateTime object to its equivalent short time string representation.
Public methodSupported by Silverlight for Windows PhoneSupported by Xbox 360 ToString() Converts the value of the current DateTime object to its equivalent string representation. (Overrides ValueType.ToString().)
Public methodSupported by Silverlight for Windows PhoneSupported by Xbox 360 ToString(IFormatProvider) Converts the value of the current DateTime object to its equivalent string representation using the specified culture-specific format information.
Public methodSupported by Silverlight for Windows PhoneSupported by Xbox 360 ToString(String) Converts the value of the current DateTime object to its equivalent string representation using the specified format.
Public methodSupported by Silverlight for Windows PhoneSupported by Xbox 360 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 methodSupported by Silverlight for Windows PhoneSupported by Xbox 360 ToUniversalTime Converts the value of the current DateTime object to Coordinated Universal Time (UTC).
Public methodStatic memberSupported by Silverlight for Windows PhoneSupported by Xbox 360 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 methodStatic memberSupported by Silverlight for Windows PhoneSupported by Xbox 360 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 methodStatic memberSupported by Silverlight for Windows PhoneSupported by Xbox 360 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 methodStatic memberSupported by Silverlight for Windows PhoneSupported by Xbox 360 TryParseExact(String, array<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

Explicit Interface Implementations

  Name Description
Explicit interface implemetationPrivate methodSupported by Silverlight for Windows PhoneSupported by Xbox 360 IConvertible.ToBoolean Infrastructure. This conversion is not supported. Attempting to use this method throws an InvalidCastException.
Explicit interface implemetationPrivate methodSupported by Silverlight for Windows PhoneSupported by Xbox 360 IConvertible.ToByte Infrastructure. This conversion is not supported. Attempting to use this method throws an InvalidCastException.
Explicit interface implemetationPrivate methodSupported by Silverlight for Windows PhoneSupported by Xbox 360 IConvertible.ToChar Infrastructure. This conversion is not supported. Attempting to use this method throws an InvalidCastException.
Explicit interface implemetationPrivate methodSupported by Silverlight for Windows PhoneSupported by Xbox 360 IConvertible.ToDateTime Infrastructure. Returns the current DateTime object.
Explicit interface implemetationPrivate methodSupported by Silverlight for Windows PhoneSupported by Xbox 360 IConvertible.ToDecimal Infrastructure. This conversion is not supported. Attempting to use this method throws an InvalidCastException.
Explicit interface implemetationPrivate methodSupported by Silverlight for Windows PhoneSupported by Xbox 360 IConvertible.ToDouble Infrastructure. This conversion is not supported. Attempting to use this method throws an InvalidCastException.
Explicit interface implemetationPrivate methodSupported by Silverlight for Windows PhoneSupported by Xbox 360 IConvertible.ToInt16 Infrastructure. This conversion is not supported. Attempting to use this method throws an InvalidCastException.
Explicit interface implemetationPrivate methodSupported by Silverlight for Windows PhoneSupported by Xbox 360 IConvertible.ToInt32 Infrastructure. This conversion is not supported. Attempting to use this method throws an InvalidCastException.
Explicit interface implemetationPrivate methodSupported by Silverlight for Windows PhoneSupported by Xbox 360 IConvertible.ToInt64 Infrastructure. This conversion is not supported. Attempting to use this method throws an InvalidCastException.
Explicit interface implemetationPrivate methodSupported by Silverlight for Windows PhoneSupported by Xbox 360 IConvertible.ToSByte Infrastructure. This conversion is not supported. Attempting to use this method throws an InvalidCastException.
Explicit interface implemetationPrivate methodSupported by Silverlight for Windows PhoneSupported by Xbox 360 IConvertible.ToSingle Infrastructure. This conversion is not supported. Attempting to use this method throws an InvalidCastException.
Explicit interface implemetationPrivate methodSupported by Silverlight for Windows PhoneSupported by Xbox 360 IConvertible.ToType Infrastructure. Converts the current DateTime object to an object of a specified type.
Explicit interface implemetationPrivate methodSupported by Silverlight for Windows PhoneSupported by Xbox 360 IConvertible.ToUInt16 Infrastructure. This conversion is not supported. Attempting to use this method throws an InvalidCastException.
Explicit interface implemetationPrivate methodSupported by Silverlight for Windows PhoneSupported by Xbox 360 IConvertible.ToUInt32 Infrastructure. This conversion is not supported. Attempting to use this method throws an InvalidCastException.
Explicit interface implemetationPrivate methodSupported by Silverlight for Windows PhoneSupported by Xbox 360 IConvertible.ToUInt64 Infrastructure. This conversion is not supported. Attempting to use this method throws an InvalidCastException.

Top