On Nov 19, 7:37 am, Guy Cohen <GuyCo...@discussions.microsoft.com>
wrote:
Hello
how do I get the day/month/year part of a date in vb.net?
sample in vb6:
day(13/10/2001) = 13
month(13/10/2001) = 10
year(13/10/2001) = 2001
Thanks
Guy
While, you have the visual basic DataPart function:
Dim dt As New Date(2001, 10, 13) ' or As New DateTime(2001, 10, 13)
Console.WriteLine(DatePart(DateInterval.Day, dt))
Console.WriteLine(DatePart(DateInterval.Month, dt))
Console.WriteLine(DatePart(DateInterval.Year, dt))
Or you can just use the standard date properties:
Console.WriteLine(dt.Day)
Console.WriteLine(dt.Month)
Console.WriteLine(dt.Year)
--
Tom Shelton