The jquery FullCalendar plugin has a neat format for time.
If it the time is 7:00pm, the format shows up as 7p.
If it the time is 7:30am, the format shows up as 7:30a.
Question: Is there any way to use standard formatting to accomplish this with c# sharp? Obviously I can create logic to do this myself, but I’m hoping there is a format string that will accopmlish this.
ie (doesn’t work):
MyDateTime.ToString("h{:mm}t");
Formatting strings do not have conditionals – there is no way to specify a condition within a format string.
You will need to use a standard
ifand format accordingly.Or, in one line: