467,927 Members | 1,980 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 467,927 developers. It's quick & easy.

Format a Date from a DataBinder.Eval

Hello,

I have a date in a SQL Database and want to use the dateformat tools to
format the output. I am now using the Month, Day, and Year to do it now.

I want to change:

Released Date: <%#Month(DataBinder.Eval(Container.DataItem, "ProdDate"))
& "/" & Day(DataBinder.Eval(Container.DataItem, "ProdDate")) & "/" &
Year(DataBinder.Eval(Container.DataItem, "ProdDate")) %><BR><BR>
To:

Released Date: <%#DataBinder.Eval(Container.DataItem,
"ProdDate").ToString("d")%><BR><BR>

But I get an error.

Any help would be great!!!

Thanks for you time and help,

Jack
Nov 18 '05 #1
  • viewed: 20225
Share:
2 Replies
Jack,

I haven't tested this code but it will look something like this:

<%#String.Format("d", DataBinder.Eval(Container.DataItem,
"ProdDate").ToString)%>

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"jack" <ja**@mrolinux.com> wrote in message
news:uR**************@TK2MSFTNGP10.phx.gbl...
Hello,

I have a date in a SQL Database and want to use the dateformat tools to
format the output. I am now using the Month, Day, and Year to do it now.

I want to change:

Released Date: <%#Month(DataBinder.Eval(Container.DataItem, "ProdDate")) & "/" & Day(DataBinder.Eval(Container.DataItem, "ProdDate")) & "/" &
Year(DataBinder.Eval(Container.DataItem, "ProdDate")) %><BR><BR>
To:

Released Date: <%#DataBinder.Eval(Container.DataItem,
"ProdDate").ToString("d")%><BR><BR>

But I get an error.

Any help would be great!!!

Thanks for you time and help,

Jack

Nov 18 '05 #2
you can use this:

<%# DataBinder.Eval(Container.DataItem, "ProdDate", "{0:d}")%>

that should do the trick

From http://www.developmentnow.com/g/8_20...inder-Eval.htm

Posted via DevelopmentNow.com Groups
http://www.developmentnow.com
Nov 19 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Michelle Keys | last post: by
1 post views Thread by A Ratcliffe | last post: by
4 posts views Thread by Wayne Wengert | last post: by
2 posts views Thread by Oleg Ogurok | last post: by
4 posts views Thread by CharlesA | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.