I push a button on a web page. I am trying to get the current date into 3 variables Year, Month, and Day In the Code behind I Have:

Dim intDay As Integer

intDay = Date.Now.Day

I get error message

Input string was not in a correct format.

Suggestions?

There is nothing wrong with the code you posted.

See this ideone for the same code which compiles and executes just fine.

<!-- language: lang-vb -->
Dim intDay As Integer
intDay = Date.Now.Day
Console.WriteLine(intDay)

The Now property returns the current time as a DateTime value. On which you can call the Day property which returns an integer

The error message you got refers to a string which is not in the posted code so I'm guessing the problem is somewhere else