DateTime format
-
Hi All, I need to display time in the following format in c#: 7:40a (not AM/PM whole word just A/P in lowercase) So how could I achieve this?
-
Hi All, I need to display time in the following format in c#: 7:40a (not AM/PM whole word just A/P in lowercase) So how could I achieve this?
rachitdamani wrote:
I need to display time in the following format in c#: 7:40a
I don't know this is the rite method. But it will work Try
string strDate = DateTime.Now.ToShortTimeString();
strDate = strDate.ToLower().Replace("am","a");
strDate = strDate.ToLower().Replace("pm","p");
Console.WriteLine(strDate);
Console.ReadLine();:cool:
printf("Navaneeth!!") www.w3hearts.com
-
rachitdamani wrote:
I need to display time in the following format in c#: 7:40a
I don't know this is the rite method. But it will work Try
string strDate = DateTime.Now.ToShortTimeString();
strDate = strDate.ToLower().Replace("am","a");
strDate = strDate.ToLower().Replace("pm","p");
Console.WriteLine(strDate);
Console.ReadLine();:cool:
printf("Navaneeth!!") www.w3hearts.com
Thnx buddy, it is working fine.