DataTable - Date Difference

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am trying to set up an Expression column in a DataTable for display in a
DataGrid that subtract the column ("BirthDay") from todays date. I can't
seem to get it right...is this possible?
 
What do you have so far? What code are you using to populate the
datatable?

Thanks,

Seth Rowe
 
Dennis,

I don't know if it is possible, but the first thing you have to ask to
yourself is what difference do you want.

Days, Months, Years (I do not know how to get that in the expression).

Be aware what is nowhere told that you have to use the literal #MM-dd-yyyy#
expression for Dates in the expression. For you as American not such a
problem of course because that is in USA notation (for others who reads this
afterwards).

Cor
 
Below is what I've tried that I think is nearest to what might work. After
defining the datacolumn, I then add it to a datatable. Note that ""BirthDay"
is a column of type DateTime in the DataTable.

Dim col8 As DataColumn = New DataColumn("AgeToday",
System.Type.GetType("System.TimeSpan"),"#10-30-2006# - BirthDay")

The column get added to the datatable ok but when I fill in the "BirthDay"
column with some data, I get the error "cannot perform the operation on
System.DateTime and System.DateTime".
 
Dennis,

Now you write it, the timespan in the documentation is a documentation bug
that exist altready 3 years. It is reported by the way.

Cor
 
Back
Top