Click here to Skip to main content
13,000,636 members (57,840 online)
Rate this:
Please Sign up or sign in to vote.
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 19:55pm
Updated 12-Oct-12 19:57pm

1 solution

Rate this: bad
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[^]

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

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.170624.1 | Last Updated 13 Oct 2012
Copyright © CodeProject, 1999-2017
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