Day Function

Returns a Variant (Integer) specifying a whole number between 1 and 31, inclusive, representing the day of the month.



The required date argument (argument: A value that provides information to an action, an event, a method, a property, a function, or a procedure.) is any Variant (Variant data type: The default data type for variables that don't have type-declaration characters when a Deftype statement isn't in effect. A Variant can store numeric, string, date/time, Null, or Empty data.), numeric expression (numeric expression: Any expression that evaluates to a number. The expression can be any combination of variables, constants, functions, and operators.), string expression (string expression: An expression that evaluates to a sequence of contiguous characters. Elements of the expression can be: functions that return a string or a string Variant (VarType 8); a string literal, constant, variable, or Variant.), or any combination of these that can represent a date. If date contains Null (Null: A value you can enter in a field or use in expressions or queries to indicate missing or unknown data. In Visual Basic, the Null keyword indicates a Null value. Some fields, such as primary key fields, can't contain a Null value.), Null is returned.

 Note   If the Calendar property setting is Gregorian, the returned integer represents the Gregorian day of the month for the date argument. If the calendar is Hijri, the returned integer represents the Hijri day of the month for the date argument.


 Note   Examples that follow demonstrate the use of this function in a Visual Basic for Applications (VBA) module. For more information about working with VBA, select Developer Reference in the drop-down list next to Search and enter one or more terms in the search box.

This example uses the Day function to obtain the day of the month from a specified date. In the development environment, the date literal is displayed in short format using the locale settings of your code.

Dim MyDate, MyDay
MyDate = #February 12, 1969#    ' Assign a date.
MyDay = MyDate    ' MyDay contains 12.

Applies to:
Access 2007