Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: VC7 MFC VS2010 VC++
My app is used to send data from PC to a Asynchronous LED display... My display controller card has 3 options like Text Content, Dynamic Content and Image Content.. Every content type requires a string to be attached with it.. I wanted to display clock.. So It comes under Dynamic Content Type.. String format for getting the clock on display is HH:mm:ss.. Now it is diplaying a 24hr clock.. how can i change it to 12hr clock with AM/PM attached to it.... I've tried "t" and "T".. But that doesn't work..
Posted 12-Oct-12 20:55pm
Edited 12-Oct-12 20:57pm
v2

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Assuming that your LED display just takes a string:
string tweleveHourDisplay = DateTime.Now.ToString("hh:mm:ss tt");
Do note that the case of each element there is significant: "HH:MM:SS TT" would give you a very different (and very, very wrong) result.
 
There is a tip here that describes the individual elements: Formatting a DateTime for display - format string description[^]
  Permalink  

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

  Print Answers RSS
0 OriginalGriff 245
1 Kamal Rocks 184
2 Sergey Alexandrovich Kryukov 175
3 BillWoodruff 173
4 PIEBALDconsult 160
0 OriginalGriff 5,655
1 DamithSL 4,506
2 Maciej Los 3,997
3 Kornfeld Eliyahu Peter 3,480
4 Sergey Alexandrovich Kryukov 3,180


Advertise | Privacy | Mobile
Web03 | 2.8.141216.1 | Last Updated 13 Oct 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100