Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Formatting a date as "long date" in a repeater

Status
Not open for further replies.

Mischeif

Programmer
Mar 4, 2003
2
GB
Hello
I'm having a little problem with formatting the date as "long date" in a repeater. I searched msdn and came up empty-handed. I could really use some help please.

My <ItemTemplate> content looks like this as I am using an Access database...

<%#Container.DataItem(&quot;OrderDate&quot;)%>

I would be grateful for any help in this matter.

Thanks
 
You can define a formatting function in your codebehind, and call it during binding.

protected string formatDate(object d){
string output = string.Empty;
if(d!=null)
output = String.Format(&quot;{0:d}&quot;, d);
return output;
}

and call it like so:

<%# formatDate(Container.DataItem(&quot;OrderDate&quot;)) %>

-paul
penny1.gif
penny1.gif

The answer to getting answered -- faq855-2992
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top