Formatting a date FROM SQL

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
 
S

Shiva

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
 
G

Guest

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
 
D

Darrel

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
 
D

Darrel

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

Thanks, Shiva!

-Darrel
 

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

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,012
Latest member
RoxanneDzm

Latest Threads

Top