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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Leading zeros

Status
Not open for further replies.

song2siren

Programmer
Jun 4, 2003
103
GB
Hello

I just need to be able to remove leading zeros from the date in this literal:

<asp:Literal id="lit_Date1" runat="server" text='<%# String.Format("{0:D}",Container.DataItem("conf_date")) %>' />

So, 02 March 2005 should display as 2 March 2005. Is there a simple way to do this without writing a subroutine?

Any help/suggestions would be very much appreciated.
 
You could try using the DateTime Format string something like this.
Code:
<asp:Literal id="lit_Date1" runat="server" text='<%# Container.DataItem("conf_date").ToString("d MMMM yyyy") %>' />
You may have to cast the DataItem as DateTime first if it is a string.

Rob


[i]i'm a boy, called Bert, and I may not be crazy, but if i'm not the rest of you are...[/i]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top