|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
day/month/year parts of a dateHello
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 On Nov 19, 7:37 am, Guy Cohen <GuyCo***@discussions.microsoft.com>
wrote: > Hello While, you have the visual basic DataPart function:> 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 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 I think I found it...
DateTime.Day was converted to DateAndTime.Day... Show quoteHide quote :) Guy "Guy Cohen" 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 You were sending at the same time as Tom, for the Google searchers. Take the
answer from Tom. Cor
Type inference
Read very large file in bytearray and upload to MSSQL VB calling DLL only with _stdcall? Getting a subset of DataRows from a DataTable Web Server Read/Write Problem with ToolStripTextBox Insert smaller images into one Image object Edit And Continue doesn't work :-( Form - controls is placed different on Vista than in XP design pattern vb.net |
|||||||||||||||||||||||