< Day Day Up > |
The DateAndTime module contains methods useful for manipulating date and time values. Public ReadOnly Property Now() As Date The Now property returns the current date and time. Public Function DateAdd(ByVal Interval As DateInterval, _ ByVal Number As Double, ByVal DateValue As Date) As Date Public Function DateAdd(ByVal Interval As String, _ ByVal Number As Double, ByVal DateValue As Object) As Date The DateAdd function adds (or subtracts) the specified number of units from the supplied date. Public Function DateDiff(ByVal Interval As DateInterval, _ ByVal Date1 As Date, ByVal Date2 As Date, _ Optional ByVal DayOfWeek As FirstDayOfWeek = FirstDayOfWeek.Sunday, _ Optional ByVal WeekOfYear As FirstWeekOfYear = FirstWeekOfYear.Jan1) _ As Long Public Function DateDiff(ByVal Interval As String, _ ByVal Date1 As Object, ByVal Date2 As Object, _ Optional ByVal DayOfWeek As FirstDayOfWeek = FirstDayOfWeek.Sunday, _ Optional ByVal WeekOfYear As FirstWeekOfYear = FirstWeekOfYear.Jan1) _ As Long The DateDiff function returns the number of specified units that the two dates differ by. The DayOfWeek and WeekOfYear parameters can be used to specify the behavior of the calendar used to determine the result. Public Function DatePart(ByVal Interval As DateInterval, _ ByVal DateValue As Date, _ Optional ByVal FirstDayOfWeekValue As FirstDayOfWeek = _ vbSunday, _ Optional ByVal FirstWeekOfYearValue As FirstWeekOfYear = vbFirstJan1) As Integer Public Function DatePart(ByVal Interval As String, _ ByVal DateValue As Object, _ Optional ByVal DayOfWeek As FirstDayOfWeek = _ FirstDayOfWeek.Sunday, _ Optional ByVal WeekOfYear As FirstWeekOfYear = _ FirstWeekOfYear.Jan1) As Integer The DatePart function returns the number of specified units that are in the date value. The FirstDayOfWeekValue and FirstWeekOfYearValue parameters can be used to specify the behavior of the calendar used to determine the result. Public Function DateSerial(ByVal Year As Integer, _ ByVal Month As Integer, ByVal Day As Integer) As Date The DateSerial function returns a date made up of the Month , Day , and Year values given. If Year is less than 1, the value is subtracted from the current year. The Month value represents the specified month in the current year. Month values less than 1 represent months in previous years (0 is December in the previous year, “1 is November in the previous year, etc.); Month values greater than 12 represent months in the following years (13 is January in the next year). The Day value represents the specified day in the specified month. Day values less than 1 represent days in previous months (0 is the last day of the previous month); Day values greater than the number of days in the month represent days in the following months. Public Property DateString() As String The DateString property returns the current date as a string. Public Function DateValue(ByVal StringDate As String) As Date The DateValue function returns the date that corresponds to the given string. Public Function Day(ByVal DateValue As Date) As Integer The Day function returns the days value of the given date. Public Function Hour(ByVal TimeValue As Date) As Integer The Hour function returns the hours value of the given date. Public Function Minute(ByVal TimeValue As Date) As Integer The Minute function returns the minutes value of the given date. Public Function Month(ByVal DateValue As Date) As Integer The Month function returns the months value of the given date. Public Function MonthName(ByVal Month As Integer, _ Optional ByVal Abbreviate As Boolean = False) As String The MonthName function returns the name of the given month in the current culture of the thread. The Abbreviate parameter determines whether the string returned is the full name or the abbreviated name of the month (i.e., "January" versus "Jan"). Public Function Second(ByVal TimeValue As Date) As Integer The Second function returns the seconds value of the given date. Public ReadOnly Property Timer() As Double The Timer property returns a value that represents the number of clock ticks since midnight. Public Function TimeSerial(ByVal Hour As Integer, _ ByVal Minute As Integer, ByVal Second As Integer) As Date The TimeSerial function returns a time during the day representing the Hour , Minute , and Second values given. If any of the values are less than 0 or greater than their maximum possible value, the values wrap around (i.e., a Minute value of 65 will add one hour and 15 minutes). Public Property TimeString() As String The TimeString property returns the current time as a string. Public Function TimeValue(ByVal StringTime As String) As Date The TimeValue function returns the time that corresponds to the given string. Public Property Today() As Date The Today property returns the current date. Assigning a date value to this property sets the date for the machine. Public Property TimeOfDay() As Date The TimeOfDay property returns the current time. Assigning a time value to this property sets the time for the machine. Public Function Weekday(ByVal DateValue As Date, _ Optional ByVal DayOfWeek As FirstDayOfWeek = FirstDayOfWeek.Sunday) _ As Integer The Weekday function returns the day of the week of the given date. The DayOfWeek parameter can be used to specify the behavior of the calendar used to determine the result. Public Function Year(ByVal DateValue As Date) As Integer The Year function returns the years value of the given date. Public Function WeekdayName(ByVal Weekday As Integer, _ Optional ByVal Abbreviate As Boolean = False, _ Optional ByVal FirstDayOfWeekValue As FirstDayOfWeek = _ FirstDayOfWeek.System) As String The WeekdayName function returns the name of the given day of the week in the current culture of the thread. The Abbreviate parameter determines whether the string returned is the full name or the abbreviated name of the month (i.e., "Monday" versus "Mon"). The FirstDayOfWeekValue parameter can be used to specify the behavior of the calendar used to determine the result. |
< Day Day Up > |