Format date in datacolumn?

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

Guest

I've got a datatable with 3 columns:
-A string
-A datetime
-An expression-based column

I want the expression based column to be a representation of both of the
other columns. The expression looks like:

ColString + ' ' + ColDate

The only problem is that the datetime format is very verbose. I don't need
the time at all, and I'd rather only have the month and year. Is there any
way to adjust this formatting in this scenario?

Thanks...

-Ben
 
Hi benji,

You might consider playing with SUBSTRING function or do the filling
manually instead of using expressions.
 
Hi Miha,

Thanks for the response. Could you elaborate a bit about doing the filling
manually?

Thanks...

-Ben

Miha Markic said:
Hi benji,

You might consider playing with SUBSTRING function or do the filling
manually instead of using expressions.

--
Miha Markic [MVP C#, INETA Country Leader for Slovenia]
RightHand .NET consulting & development www.rthand.com
Blog: http://cs.rthand.com/blogs/blog_with_righthand/

benji said:
I've got a datatable with 3 columns:
-A string
-A datetime
-An expression-based column

I want the expression based column to be a representation of both of the
other columns. The expression looks like:

ColString + ' ' + ColDate

The only problem is that the datetime format is very verbose. I don't need
the time at all, and I'd rather only have the month and year. Is there any
way to adjust this formatting in this scenario?

Thanks...

-Ben
 
benji said:
Hi Miha,

Thanks for the response. Could you elaborate a bit about doing the filling
manually?

Use a normal instead of expression column. And then just fill it in a loop
and when a relevant column value changes (DataTable.ColumnChanged event).
 
Hi Miha,

Do you have a suggestion of where to place the loop code? Is there an event
that you'd suggest I handle for this? (Same question for when data changes)

Thanks...

-Ben
 
I would fill the data after dataset is filled and then I would hook up
ColumnChanged event to update my data.
 
Back
Top