Export (0) Print
Expand All

DateTime Methods

The methods of the DateTime structure are listed here. For a complete list of DateTime structure members, see the DateTime Members topic.

Public Methods

public methodAdd

Supported by the .NET Compact Framework.

Adds the value of the specified TimeSpan to the value of this instance.
public methodAddDays

Supported by the .NET Compact Framework.

Adds the specified number of days to the value of this instance.
public methodAddHours

Supported by the .NET Compact Framework.

Adds the specified number of hours to the value of this instance.
public methodAddMilliseconds

Supported by the .NET Compact Framework.

Adds the specified number of milliseconds to the value of this instance.
public methodAddMinutes

Supported by the .NET Compact Framework.

Adds the specified number of minutes to the value of this instance.
public methodAddMonths

Supported by the .NET Compact Framework.

Adds the specified number of months to the value of this instance.
public methodAddSeconds

Supported by the .NET Compact Framework.

Adds the specified number of seconds to the value of this instance.
public methodAddTicks

Supported by the .NET Compact Framework.

Adds the specified number of ticks to the value of this instance.
public methodAddYears

Supported by the .NET Compact Framework.

Adds the specified number of years to the value of this instance.
public methodstatic (Shared in Visual Basic)Compare

Supported by the .NET Compact Framework.

Compares two instances of DateTime and returns an indication of their relative values.
public methodCompareTo

Supported by the .NET Compact Framework.

Compares this instance to a specified object and returns an indication of their relative values.
public methodstatic (Shared in Visual Basic)DaysInMonth

Supported by the .NET Compact Framework.

Returns the number of days in the specified month of the specified year.
public methodEquals

Supported by the .NET Compact Framework.

Overloaded. Overridden. Returns a value indicating whether an instance of DateTime is equal to a specified object.
public methodstatic (Shared in Visual Basic)FromFileTime

Supported by the .NET Compact Framework.

Returns a DateTime equivalent to the specified operating system file timestamp.
public methodstatic (Shared in Visual Basic)FromFileTimeUtc

Supported by the .NET Compact Framework.

Returns a DateTime equivalent to the specified operating system file timestamp, adjusted to coordinated universal time (UTC).
public methodstatic (Shared in Visual Basic)FromOADate Returns a DateTime equivalent to the specified OLE Automation Date.
public methodGetDateTimeFormats

Supported by the .NET Compact Framework.

Overloaded. Converts the value of this instance to all the string representations supported by the standard DateTime format specifiers.
public methodGetHashCode

Supported by the .NET Compact Framework.

Overridden. Returns the hash code for this instance.
public methodGetType (inherited from Object)

Supported by the .NET Compact Framework.

Gets the Type of the current instance.
public methodGetTypeCode

Supported by the .NET Compact Framework.

Returns the TypeCode for value type DateTime.
public methodstatic (Shared in Visual Basic)IsLeapYear

Supported by the .NET Compact Framework.

Returns an indication whether the specified year is a leap year.
public methodstatic (Shared in Visual Basic)Parse

Supported by the .NET Compact Framework.

Overloaded. Converts the specified string representation of a date and time to its DateTime equivalent.
public methodstatic (Shared in Visual Basic)ParseExact

Supported by the .NET Compact Framework.

Overloaded. Converts the specified string representation of a date and time to its DateTime equivalent. The format of the string representation must match a specified format exactly.
public methodSubtract

Supported by the .NET Compact Framework.

Overloaded. Subtracts the specified time or duration from this instance.
public methodToFileTime

Supported by the .NET Compact Framework.

Converts the value of this instance to the format of a local operating system file time.
public methodToFileTimeUtc

Supported by the .NET Compact Framework.

Converts the value of this instance to the format of operating system file time, ignoring the local time zone.
public methodToLocalTime

Supported by the .NET Compact Framework.

Converts the current coordinated universal time (UTC) to local time.
public methodToLongDateString

Supported by the .NET Compact Framework.

Converts the value of this instance to its equivalent long date string representation.
public methodToLongTimeString

Supported by the .NET Compact Framework.

Converts the value of this instance to its equivalent long time string representation.
public methodToOADate Converts the value of this instance to the equivalent OLE Automation date.
public methodToShortDateString

Supported by the .NET Compact Framework.

Converts the value of this instance to its equivalent short date string representation.
public methodToShortTimeString

Supported by the .NET Compact Framework.

Converts the value of this instance to its equivalent short time string representation.
public methodToString

Supported by the .NET Compact Framework.

Overloaded. Overridden. Converts the value of this instance to its equivalent string representation.
public methodToUniversalTime

Supported by the .NET Compact Framework.

Converts the current local time to coordinated universal time (UTC).

Protected Methods

protected methodFinalize (inherited from Object)

Supported by the .NET Compact Framework.

Overridden. Allows an Object to attempt to free resources and perform other cleanup operations before the Object is reclaimed by garbage collection.

In C# and C++, finalizers are expressed using destructor syntax.

protected methodMemberwiseClone (inherited from Object)

Supported by the .NET Compact Framework.

Creates a shallow copy of the current Object.

See Also

DateTime Structure | System Namespace

Show:
© 2014 Microsoft