05-31-2011 03:50 PM
I wanted Labview to display the time in milliseconds and I got that to work. I want to display PM or AM after the milliseconds so it looks like this
05/31/11 4:45:39.849 PM
I am using %p as you can see in the picture, but it is not working. PM or AM does not show up.
What am I doing wrong?
Thanks in advance.
Solved! Go to Solution.
05-31-2011 04:09 PM
Replace your %H with a %I. %H is 24 hour time which has no A.M or P.M designation. You need to use 12 hour time.
05-31-2011 04:15 PM - edited 05-31-2011 04:17 PM
You need I instead of H for the hour portion. H is for a 24 hour clock, so that wipes out any meaning for AM/PM.
I've never used Format into Date/Time String, and just use Format into String. This gives you the ability to add other data into the string.
05-31-2011 04:32 PM
Why is it "H" for the 24 hour clock and "I "is for a 12-hour clock? "I" is not logical at all other than the fact is follows "H".
I think it would make more sense the other way around. "H" for the 12 hour clock and I for the 24-hour clock, since 12 comes before 24. Also, "I" could mean "international".
05-31-2011 04:49 PM
@Ravens Fan wrote:
Why is it "H" for the 24 hour clock and "I "is for a 12-hour clock? "I" is not logical at all other than the fact is follows "H".
I think it would make more sense the other way around. "H" for the 12 hour clock and I for the 24-hour clock, since 12 comes before 24. Also, "I" could mean "international".
That notation is the ISO-C standard so you'd probably have to bring it up with them. I tend to remember that 'I' stands for illogical and the 12-hour clock certainly qualifies.
06-01-2011 01:07 AM
I didn't realize there was an ISO standard on shortcuts.
What is interesting is that Excel's custom date codes for a cell format only use an "h". It is the presence or lack thereof of the AM/PM in the date code that tells it to use the 12 hour clock or the 24 hour clock.
Darin.K wrote:
I tend to remember that 'I' stands for illogical and the 12-hour clock certainly qualifies.
You lost me on that comment.
06-01-2011 08:47 AM
Thank you for everyone who replied. All the comments were insightful and helpful. Thank you.
06-01-2011 12:03 PM
@Ravens Fan wrote:
I didn't realize there was an ISO standard on shortcuts.
What is interesting is that Excel's custom date codes for a cell format only use an "h". It is the presence or lack thereof of the AM/PM in the date code that tells it to use the 12 hour clock or the 24 hour clock.
@Darin.K wrote:
I tend to remember that 'I' stands for illogical and the 12-hour clock certainly qualifies.You lost me on that comment.
IMO, other than colloquial use, the 12 hour format is woefully outdated. Using it as a timestamp just does not make sense to me. There is a two-fold degeneracy which is only broken by a separate am/pm flag (or is it a.m., AM, A.M.) so it takes more space and longer regexes to deal with. These timestamps are not easily sortable, nor comparable without preprocessing. That is part of the reason why I think it is 'illogical' to use it (for lack of a better mnemonic).
And the ISO standard is on the C-language, of which these shortcuts are part. I have a sneaking suspicion that I know what happens under the hood of the Format functions which use time codes...
06-01-2011 12:18 PM
Okay, I agree with you there. If I need to do anything that is text based, date and time format, I'll save it as 24hour data so that it can be sortable. For instance, creating a filename based on date and time, I'll do a year-month-day 24hr-min-sec format (with whatever punctuation/separators I feel like at the time to be somewhat readable) all zero filled so a month like June is 06, so that alphabetically sorting by that data also causes it to be chronologically sorted.
If it is just for the sake of a front panel display for the user to see a time, then I'll use 12 hour with am/pm and a normal month/day/year format so that the user doesn't have to do any mental math. 7:00 pm is meaningful, 1900 requires too much thinking.
06-01-2011 01:18 PM
Raven's I would disagree, but I think you use the default system formatting for any user controls, right?
Ton