Format date in datacolumn?

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
 
M

Miha Markic

Hi benji,

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

Guest

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
 
M

Miha Markic

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).
 
G

Guest

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
 
M

Miha Markic

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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top