Search
Winners

Win Prizes

Social Presence
Twitter Twitter LinkedIn YouTube Google

Like us on Facebook
Advertisements
Top Forums Author
Fri, 29-Aug-2014 Authors
Modit
10
All Time Authors
Jayakumars
4160
Karthikanbarasan
3455
Chvrsri
3140

Latest members | More ...


(Statistics delayed by 5 minutes)
 Forum Post

How to convert a Time in 24 hours format?

Raja
Posted by Raja under C# on 7/22/2009 6:47:11 AM | Views : 86155 | Status : [Member] | Replies : 3


I have to write current time in 24 hours format in C#, how to do that?

Thanks

Regards,
Raja, USA


Posted by: Poster on: 7/22/2009 [Member] Starter

See following example

DateTime d = DateTime.Now;

// 12 hour format
Response.Write(d.ToString("hh:mm") + " | " );

// 24 hour format
Response.Write(d.ToString("H:mm"));


so instead of h write capital H and time will be converted in 24 hours format.

Hope this helps.

Raja, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Webmaster on: 8/26/2009 [Administrator] HonoraryPlatinum

Thanks Poster for helping the visitors.

Regards,

Best regards,
Webmaster
http://www.dotnetfunda.com

Raja, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Raja on: 8/26/2009 [Member] Starter

Thanks Webmaster. Its my pleasure to help the visitors.

Thanks

Regards,
Raja, USA

Raja, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response


Found interesting? Add this to: