• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1081
  • Last Modified:

DataBinder.Eval format date with "th"

Hi,

I am formatting a date as follows:

<%#DataBinder.Eval(Container.DataItem, "news_date", "{0:dd MMMMMM yyyy}")%>

This formats the date as: 29 August 2012

Is there a way format the date as: 29th August 2012

Thanks,

Richard
0
rpm
Asked:
rpm
1 Solution
 
CodeCruiserCommented:
What if date is 1 August, or 2 August, or 3 August? It would need to be intelligent so you probably want to write a method which returns you formatted date

<%#FormatDate(DataBinder.Eval(Container.DataItem, "news_date", "{0:dd MMMMMM yyyy}"))%>


Public Function FormatDate(TheDate As Date) As string
     'Logic here
End Function
0
 
rpmAuthor Commented:
Obvious when you think about it!

Thanks that did the trick nicely.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now