DateAndTime Class

 

The DateAndTime module contains the procedures and properties used in date and time operations.

Namespace:   Microsoft.VisualBasic
Assembly:  Microsoft.VisualBasic (in Microsoft.VisualBasic.dll)

System.Object
  Microsoft.VisualBasic.DateAndTime

[StandardModuleAttribute]
public sealed class DateAndTime

NameDescription
System_CAPS_pubpropertySystem_CAPS_staticDateString

Returns or sets a String value representing the current date according to your system.

System_CAPS_pubpropertySystem_CAPS_staticNow

Returns a Date value containing the current date and time according to your system.

System_CAPS_pubpropertySystem_CAPS_staticTimeOfDay

Returns or sets a Date value containing the current time of day according to your system.

System_CAPS_pubpropertySystem_CAPS_staticTimer

Returns a Double value representing the number of seconds elapsed since midnight.

System_CAPS_pubpropertySystem_CAPS_staticTimeString

Returns or sets a String value representing the current time of day according to your system.

System_CAPS_pubpropertySystem_CAPS_staticToday

Returns or sets a Date value containing the current date according to your system.

NameDescription
System_CAPS_pubmethodSystem_CAPS_staticDateAdd(DateInterval, Double, DateTime)

Returns a Date value containing a date and time value to which a specified time interval has been added.

System_CAPS_pubmethodSystem_CAPS_staticDateAdd(String, Double, Object)

Returns a Date value containing a date and time value to which a specified time interval has been added.

System_CAPS_pubmethodSystem_CAPS_staticDateDiff(DateInterval, DateTime, DateTime, FirstDayOfWeek, FirstWeekOfYear)

Returns a Long value specifying the number of time intervals between two Date values.

System_CAPS_pubmethodSystem_CAPS_staticDateDiff(String, Object, Object, FirstDayOfWeek, FirstWeekOfYear)

Returns a Long value specifying the number of time intervals between two Date values.

System_CAPS_pubmethodSystem_CAPS_staticDatePart(DateInterval, DateTime, FirstDayOfWeek, FirstWeekOfYear)

Returns an Integer value containing the specified component of a given Date value.

System_CAPS_pubmethodSystem_CAPS_staticDatePart(String, Object, FirstDayOfWeek, FirstWeekOfYear)

Returns an Integer value containing the specified component of a given Date value.

System_CAPS_pubmethodSystem_CAPS_staticDateSerial(Int32, Int32, Int32)

Returns a Date value representing a specified year, month, and day, with the time information set to midnight (00:00:00).

System_CAPS_pubmethodSystem_CAPS_staticDateValue(String)

Returns a Date value containing the date information represented by a string, with the time information set to midnight (00:00:00).

System_CAPS_pubmethodSystem_CAPS_staticDay(DateTime)

Returns an Integer value from 1 through 31 representing the day of the month.

System_CAPS_pubmethodEquals(Object)

Determines whether the specified object is equal to the current object.(Inherited from Object.)

System_CAPS_pubmethodGetHashCode()

Serves as the default hash function. (Inherited from Object.)

System_CAPS_pubmethodGetType()

Gets the Type of the current instance.(Inherited from Object.)

System_CAPS_pubmethodSystem_CAPS_staticHour(DateTime)

Returns an Integer value from 0 through 23 representing the hour of the day.

System_CAPS_pubmethodSystem_CAPS_staticMinute(DateTime)

Returns an Integer value from 0 through 59 representing the minute of the hour.

System_CAPS_pubmethodSystem_CAPS_staticMonth(DateTime)

Returns an Integer value from 1 through 12 representing the month of the year.

System_CAPS_pubmethodSystem_CAPS_staticMonthName(Int32, Boolean)

Returns a String value containing the name of the specified month.

System_CAPS_pubmethodSystem_CAPS_staticSecond(DateTime)

Returns an Integer value from 0 through 59 representing the second of the minute.

System_CAPS_pubmethodSystem_CAPS_staticTimeSerial(Int32, Int32, Int32)

Returns a Date value representing a specified hour, minute, and second, with the date information set relative to January 1 of the year 1.

System_CAPS_pubmethodSystem_CAPS_staticTimeValue(String)

Returns a Date value containing the time information represented by a string, with the date information set to January 1 of the year 1.

System_CAPS_pubmethodToString()

Returns a string that represents the current object.(Inherited from Object.)

System_CAPS_pubmethodSystem_CAPS_staticWeekday(DateTime, FirstDayOfWeek)

Returns an Integer value containing a number representing the day of the week.

System_CAPS_pubmethodSystem_CAPS_staticWeekdayName(Int32, Boolean, FirstDayOfWeek)

Returns a String value containing the name of the specified weekday.

System_CAPS_pubmethodSystem_CAPS_staticYear(DateTime)

Returns an Integer value from 1 through 9999 representing the year.

This module supports the Visual Basic language keywords and run-time library members that get the current date or time, perform date calculations, return a date or time, set the date or time, or time the duration of a process.

This example uses the Today property to return the current system date.

Dim thisDate As Date
thisDate = Today 

.NET Framework
Available since 1.1
Silverlight
Available since 2.0

Any public static ( Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Return to top
Show: