<asp:Label ID="Label1" runat="server" Text='<%# Bind("Date") %>'></asp:Label>
Displays
03.06.2014 10:30:00
How can I display it as 3 Jun 2014 10:30
This should work:
<asp:Label ID="Label1" runat="server"
Text='<%# Eval("Date", "{0:d MMM yyyy HH:mm}") %>'>
</asp:Label>
See: Custom Date and Time Format Strings
Try this:
Text='<%# Eval("Date", "{d MMM yyyy hh:mm}") %>'
You can see more format strings here.
Try this
<asp:Label ID="Label1" runat="server"
Text='<%# Bind("Date").ToString("d MMM yyyy hh:mm:ss",CultureInfo.CreateSpecificCulture("en-US")) %>'>
</asp:Label>
ref: Custom date time formats
Maybe something like this:
Bind("Date").ToString("d MMM yyyy hh:mm")
You could also do this:
string.Format("{0:d MMM yyyy hh:mm}",Bind("Date"))
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With