Click here to Skip to main content
15,920,896 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How to display am/pm beside time in asp.net c#

This is my markup code,
ASP.NET
<asp:Label ID="lblUpdatedOn" runat="server" Text='<%#Eval("UpdatedDT" ,"{0:dd/MM/yyyy hh:mm:t}") %>'/>


and it displays like this 23/10/2013 11:20


so i need like this 23/10/2013 11:20 am


Please help

thanks.
Posted
Updated 22-Oct-13 21:29pm
v2

Use this format - yyyy.MM.dd hh:mm:ss tt
 
Share this answer
 
use in this way.

C#
DateTime time = DateTime.Now;
string s = time.ToString("yyyy.MM.dd hh:mm:ss t.\\M.");
Console.WriteLine(s);
 
Share this answer
 
Comments
Member 12999372 6-May-17 3:32am    
Any one Please help me How to save like this 01:01:44 AM
 
Share this answer
 
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900