Extract values from DataReader

  • Thread starter Thread starter Michel Vanderbeke
  • Start date Start date
M

Michel Vanderbeke

When a DataReader returns a DateTime field, I want to show the year-part or
month-part of the date.
How can I do this?

txtLine = rdTest("PE_Datum").ToString
gives the complete field. I just want to show only the year, or the month.
When showing the month, I want to be able to show it in full (march) or in
number (03).

Any help is appreciated.

Many thanks,

Michel
 
Dim dAsOfDate As DateTime

dAsOfDate = DateTime.Today

dAsOfDate.Year it gives you the year

dAsOfDate.Month it gives you the month as integer

String.Format("{0:MMM}", dAsOfDate) it gives you the Month = JUN

String.Format("{0:MMMM}", dAsOfDate) it gives you the Month = JUNE



Regards,

Mihai
 
Back
Top