/* Displays the date and time as "05 Jan 2011 16:25"in a Label control inside a FormView control */
DateTime datetime = DateTime.Now; Label lblDateOfEntry = (Label)FormView1.FindControl("LabelDateOfEntry") lblDateOfEntry.Text = String.Format("{0:dd MMM yyyy HH:mm}", datetime);
DateTime datetime = DateTime.Now; Label lblDateOfEntry = (Label)FormView1.FindControl("LabelDateOfEntry") lblDateOfEntry.Text = String.Format("{0:dd MMM yyyy HH:mm}", datetime);
And here's how to format it in Markup code
<asp:Label ID="LabelDateOfEntry" runat="server" Text='<%# Bind("DateOfEntry","{0:dd MMM yyyy HH:mm}") %>' >
No comments:
Post a Comment