Name

Day Function — Microsoft.VisualBasic.DateAndTime

Synopsis

Day(datevalue)
datevalue required; Date or literal date

Date whose day number is to be extracted

Return Value

An Integer from 1 to 31, representing the day of the month

Description

Returns an Integer ranging from 1 to 31, representing the day of the month of datevalue. The range of datevalue is 1/1/1 to 12/31/9999.

With Option Strict On, you must first convert datevalue to a Date data type before passing it to the Day function. You can use the CDate function for this purpose.

If the day portion of datevalue is outside of its valid range, the function generates an exception. This is also true if the day and month portion of datevalue is 2/29 for a non-leap year.

Get VB.NET Language Pocket Reference now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.