Doug,
In addition to the other comments. I would recommend adding a second column
of type DateTime to your data table.
You could try using an Expression Column that converts from an Integer into
a Date.
http://msdn.microsoft.com/library/de...ssiontopic.asp
I would look at using modulus & division to split the int32 into year, month
& day, then use Convert & '+' to convert this into a string, and finally use
Convert to convert the string into a DateTime.
Seeing as how messy that formula might be, I would consider using a simple
for loop to update each row:
Something like (untested):
For Each row As DataRow in table.Rows
Dim yyyymmdd As Integer = DirectCast(row!yyyymmdd, Integer)
Dim yyyy As Integer = yyyymmdd \ 10000
Dim mm As Integer = (yyyymmdd \ 100) Mod 100
Dim dd As Integer = yyyymmdd Mod 100
row!theDateTime = New DateTime(yyyy, mm, dd)
Next
FWIW: I normally encapsulate the conversion from Integer to DateTime in its
own routine.
Alternatively I would consider using DataTable.Events to "compute" the
DateTime column, post if you want an example of this.
Hope this helps
Jay
"Doug Bell" <Po*********@vodaphone.com.au> wrote in message
news:Or**************@TK2MSFTNGP09.phx.gbl...
| Hi,
| I have some data in the format of yyyymmdd (Int32) that I want to display,
| in a datagrid, formatted in International Date Format dd MM yyyy.
|
| Any suggestions on an efficient approach?
|
| Thanks,
|
| Doug
|
|