Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Formatting a date FROM SQL

Reply
Thread Tools

Formatting a date FROM SQL

 
 
Darrel
Guest
Posts: n/a
 
      11-09-2004
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(Conta iner.DataItem,
"seminarTimes")), "DDDD") %>

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



-Darrel








 
Reply With Quote
 
 
 
 
Shiva
Guest
Posts: n/a
 
      11-09-2004
Hi,

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

"Darrel" <> wrote in message
news:u4$...
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(Conta iner.DataItem,
"seminarTimes")), "DDDD") %>

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



-Darrel









 
Reply With Quote
 
 
 
 
=?Utf-8?B?a2FycGFnYW0=?=
Guest
Posts: n/a
 
      11-09-2004
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

"Darrel" wrote:

> 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(Conta iner.DataItem,
> "seminarTimes")), "DDDD") %>
>
> But I get a " Overload resolution failed because no accessible 'ToString'
> can be called without a narrowing conversion: " error.
>
>
>
> -Darrel
>
>
>
>
>
>
>
>
>

 
Reply With Quote
 
Darrel
Guest
Posts: n/a
 
      11-09-2004
> 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


 
Reply With Quote
 
Darrel
Guest
Posts: n/a
 
      11-09-2004
> DataBinder.Eval takes a 3rd parameter to specify the format.

Thanks, Shiva!

-Darrel


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Date, date date date.... Peter Grison Java 10 05-30-2004 01:20 PM
Given a date, how to find the beginning date and ending date of that week Matt ASP General 11 11-08-2003 11:24 PM
Given a date, how to find the beginning date and ending date of that week Matt ASP .Net 1 11-08-2003 09:14 PM
Given a date, how to find the beginning date and ending date of that week Matt C Programming 3 11-08-2003 09:07 PM
Given a date, how to find the beginning date and ending date of that week Matt C++ 2 11-08-2003 08:30 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57