Resolved Get just the month # from date format d/m/yyyy

pnvong

New member
Joined
Apr 27, 2021
Messages
1
Programming Experience
Beginner
I'm sorry, I'm a newbie trying to learn. I'm doing this in aspx using vb.net.

I have a date format like d/m/yyy like 4/27/2021 and all I want is to grab month and turn it into an integer.

Dim TestDate as string = Now().ToShortDateString
Dim GetMonth as int

How do I get GetMonth to show just 4?
 

JohnH

VB.NET Forum Moderator
Staff member
Joined
Dec 17, 2005
Messages
15,540
Location
Norway
Programming Experience
10+
Solution
Top Bottom