Test your technical skills online, appear in Virtual Interview and be ready for job!
Twitter Twitter LinkedIn YouTube Google
Be Interview ready ! | Search
Make friends on DotNetFunda.com and expand your network!
Winners

Win Prizes

Announcements
Like us on Facebook
Sponsor
Top Forums Author
Wed, 23-Apr-2014 Authors
Brierust
10
Klbaiju
10
Naidulaxmi
10
All Time Authors
Jayakumars
3930
Karthikanbarasan
3455
Chvrsri
3140

Latest members | More ...


(Statistics delayed by 5 minutes)

How to convert a Time in 24 hours format?

Raja
Posted by Raja under C# on 7/22/2009 6:47:11 AM | Views : 76764 | Status : [Member] | Replies : 3
I have to write current time in 24 hours format in C#, how to do that?

Thanks

Regards,
Raja, USA


Reply | Reply with Attachment

=> Scroll below for responses


Comments or Responses

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.

Comments / Responses
Select text & click toolbar to format. Formatting appears in viewmode only. HTML Tags are not allowed.
Bold Italic Underline Paragraph Title Code  Link 
 Wait ... Processing ..... please wait.

Found interesting? Add this to: