Formatting a date FROM SQL

  • Thread starter Thread starter Darrel
  • Start date Start date
D

Darrel

I'm stumped on something that would seem to be pretty simple.

I have data bound to a repeater control. One of the fields is a date field
from the SQL table:

<%#DataBinder.Eval(Container.DataItem, "seminarDate")%>

This, by default, displays as:

10/12/2004 12:00:00

I'd like to format it as:

Tuesday, October 12, 2004

Can that be done with inline functions?

I've tried something like this:

<%# microsoft.VisualBasic.format(DataBinder.Eval(Container.DataItem,
"seminarTimes")), "DDDD") %>

But I get a " Overload resolution failed because no accessible 'ToString'
can be called without a narrowing conversion: " error.



-Darrel
 
Hi,

DataBinder.Eval takes a 3rd parameter to specify the format.

I'm stumped on something that would seem to be pretty simple.

I have data bound to a repeater control. One of the fields is a date field
from the SQL table:

<%#DataBinder.Eval(Container.DataItem, "seminarDate")%>

This, by default, displays as:

10/12/2004 12:00:00

I'd like to format it as:

Tuesday, October 12, 2004

Can that be done with inline functions?

I've tried something like this:

<%# microsoft.VisualBasic.format(DataBinder.Eval(Container.DataItem,
"seminarTimes")), "DDDD") %>

But I get a " Overload resolution failed because no accessible 'ToString'
can be called without a narrowing conversion: " error.



-Darrel
 
Specify the display format in the DataBinder.Eval method as

<%# DataBinder.Eval(Container.DataItem,"seminarDate","{0:dddd,MMM dd,yyyy}")%>

to display the date in the format that u mentioned
 
Specify the display format in the DataBinder.Eval method as
<%# DataBinder.Eval(Container.DataItem,"seminarDate","{0:dddd,MMM
dd,yyyy}")%>

Thanks, Karmagam...that was easier than I thought!

-Darrel
 
Back
Top