Name
Day Function
Syntax
Day(dateexpression)-
dateexpression Use: Required
Data Subtype: Any valid date expression
Any expression capable of conversion to a Date.
Return Value
Variant of subtype Integer.
Description
Returns a variant integer data subtype that can take on a value
ranging from 1 to 31, representing the day of the month of
dateexpression.
dateexpression, the argument passed to the
Day function, must be a valid date/time or time
value.
Rules at a Glance
dateexpressioncan be any variant, numeric expression, or string expression that represents a valid date.The range of
dateexpressionis 1/1/0000 to 12/31/9999.If
dateexpressionisNull,Nullis returned.
Programming Tips & Gotchas
When working with dates, always check that a date is valid using the
IsDatefunction prior to passing it as a function parameter.If
dateexpressionomits the year,Daystill returns a valid day.If the day portion of
dateexpressionis outside its valid range, the function generates runtime error 13, “Type mismatch.” This is also true if the day and month portion ofdateexpressionis 2/29 for a non-leap year.To return the day of the week, use the
WeekDayfunction.
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access