If I am missing something, you can do this:
DateTime date = DateTime.Now;
if (date.Minute == 0) {
return date.ToString("Htt");
} else {
return date.ToString("H:mmtt");
}
Obviously with extra formatting wrapped around this. But this is the core.
source
share