DateValue function
Description: Returns the Variant of the Date subtype.
Syntax: DateValue(date)
The date parameter should be a string expression, representing a date from January 1, 200 to December 31, 9999. However, date can also be any expression that represents a date, time, or date-time mixture within the above range.
Note: If the date parameter contains time information, DateValue will not return time information. However, if date contains invalid time information (such as "89:98"), an error will occur.
If date is a string containing only numbers separated by a valid date separator, DateValue will identify the order of month, day, and year according to the short date format specified for the system. DateValue also identifies a clear date containing the month name (whether it is a full name or abbreviation). For example, in addition to being able to identify 12/30/1991 and 12/30/91, DateValue also recognizes December 30, 1991 and Dec 30, 1991.
If the year part of date is omitted, DateValue will use the current year in the computer system date.
Day Function
Description: Returns an integer (including 1 and 31) between 1 and 31, representing a day in a certain month.
Syntax: Day(date)
The date parameter is any expression that can represent a date. If the date parameter contains Null, then Null is returned.
FormatDateTime function
Description: Returns the expression, which has been formatted as a date or time.
Syntax: FormatDateTime(Date[,NamedFormat])
Date: Required. The date expression to be formatted.
NamedFormat: Optional. Values indicating the date/time format used, if omitted, use vbGeneralDate.
The NamedFormat parameter can have the following values:
(The following are: constant value description)
vbGeneralDate 0 Show date and/or time. If there is a date section, the section is displayed in a short date format. If there is a time part, the part is displayed in a long time format. If all exist, all sections are displayed.
vbLongDate 1 Display dates using the long date format specified in the computer locale.
vbShortDate 2 Display dates using the short date format specified in the computer locale.
vbLongTime 3 Display time using the time format specified in the computer area settings.
vbShortTime 4 Use 24 Hour format (hh:mm) Show time.
Hour function
Description: Returns an integer between 0 and 23 (including 0 and 23), representing an hour of the day.
Syntax: Hour(time)
The time parameter is any expression that can represent time. If the time parameter contains Null, then Null is returned.
Minute function
Description: Returns an integer between 0 and 59 (including 0 and 59), representing a certain minute within an hour.
Syntax: Minute(time)
The time parameter is any expression that can represent time. If the time parameter contains Null, then Null is returned.
Month function
Description: Returns an integer (including 1 and 12) between 1 and 12, representing a month of the year.
Syntax: Month(date)
The date parameter is any expression that can represent a date. If the date parameter contains Null, then Null is returned.
MonthName function
Description: Returns a string indicating the specified month.
Syntax: MonthName(month[, abbreviate])
month: Required. The numerical definition of the month. For example, January is 1, February is 2, and so on.
abbreviate: Optional. Boolean value, indicating whether the month name is abbreviated. If omitted, the default value is False, which means that the month name is not abbreviated.
Now function
Description: Return the current date and time value according to the date and time set by the computer system.
Syntax:Now
Second function
Description: Returns an integer between 0 and 59 (including 1 and 59), representing a second within a minute.
Syntax: Second(time)
The time parameter is any expression that can represent time. If the time parameter contains Null, then Null is returned.
Time Function
Description: Returns Date subtype Variant, indicating the current system time.
Syntax: Time
TimeSerial function
Description: Returns a Variant of Date subtype, containing the specified time, minutes, and seconds.
Syntax: TimeSerial(hour, minute, second)
hour: Its value is a numerical or numerical expression from 0 (12:00 .) to 23 (11:00 .).
minute: Any numeric expression.
second: Arbitrary numeric expression.
Note: To specify a moment, such as 11:59:59, the parameter value of TimeSerial should be within an acceptable range; that is, the hours should be between 0-23, and minutes and seconds should be between 0-59. However, a numeric expression can be used to specify a relative time for each parameter, which represents the number of hours, minutes, or seconds before or after a certain moment. The following example uses an expression instead of absolute time. The TimeSerial function returns the time (-15) of six hours (12-6) and fifteen minutes before noon, that is, 5:45:00.
TimeSerial(12 - 6, -15, 0)
When the value of any parameter exceeds an acceptable range, it will correctly carry to the next larger unit of time. For example, if 75 minutes is specified, this time is interpreted as one hour and fifteen minutes. However, if any parameter value exceeds the range of -32768 to 32767, an error will be caused. An error can also result if the time specified directly with three parameters or the time calculated by the expression exceeds an acceptable date range.
TimeValue function
Description: Returns the Variant of the Date subtype containing time.
Syntax: TimeValue(time)
The time parameter is usually a string expression (including 0:00:00 and 23:59:59) that represents a string expression from 0:00:00 (12:00:00.) to 23:59:59 (11:59:59.). However, time can also be an expression representing any time in that range. If the time parameter contains Null, then Null is returned.
Note: Time can be entered in 12 or 24 hours clock format. For example, "2:24PM" and "14:24" are both valid time parameters.
If the time parameter contains date information, the TimeValue function does not return date information. However, if the time parameter contains invalid date information, an error will occur.
Weekday Function
Description: Returns an integer representing a day of the week.
Syntax: Weekday(date, [firstdayofweek])
date: Any expression that can represent a date. If the date parameter contains Null, then Null is returned.
firstdayofweek: Specify the constant of the first day of the week. If omitted, vbSunday is used by default.
The firstdayofweek parameter has the following settings:
(The following are: constant value description)
vbUseSystem 0 Use Regional Language Support (NLS) API Settings.
vbSunday 1 Sunday
vbMonday 2 Monday
vbTuesday 3 Tuesday
vbWednesday 4 Wednesday
vbThursday 5 Thursday
vbFriday 6 Friday
vbSaturday 7 Saturday
Weekday function returns the following value:
(The following are: constant value description)
vbSunday 1 Sunday
vbMonday 2 Monday
vbTuesday 3 Tuesday
vbWednesday 4 Wednesday
vbThursday 5 Thursday
vbFriday 6 Friday
vbSaturday 7 Saturday
WeekdayName function
Description: Returns a string representing a specified day of the week.
Syntax: WeekDayName(weekday, abbreviate, firstdayofweek)
weekday: Must be selected. The numerical definition of a day of the week. The numerical definition of each day depends on the firstdayofweek parameter settings.
abbreviate: Optional. Boolean value, indicating whether the abbreviation represents the name of each day of the week. If omitted, the default value is False, which means that the names of the days of the week are not abbreviated.
firstdayofweek: Optional. Specifies the value of the first day of the week. For values, see the Settings section.
The firstdayofweek parameter has the following values:
(The following are: constant value description)
vbUseSystem 0 Use Regional Language Support (NLS) API Settings.
vbSunday 1 Sunday (default)
vbMonday 2 Monday
vbTuesday 3 Tuesday
vbWednesday 4 Wednesday
vbThursday 5 Thursday
vbFriday 6 Friday
vbSaturday 7 Saturday
Year Function
Description: Returns an integer representing a certain year.
Syntax: Year(date)
The date parameter is any parameter that can represent a date. If the date parameter contains Null, then Null is returned.
Previous page12Read the full text