Click here to Skip to main content
15,889,834 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
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
Updated 12-Oct-12 19:57pm
v2

1 solution

Assuming that your LED display just takes a string:
C#
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[^]
 
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