I have two variables:
TimeSpan horaI = new TimeSpan(10, 00, 00);
TimeSpan horaF = new TimeSpan(22, 00, 00);
I need to display them on the screen as follows 10:00 AM and 10:00 PM. But I can not do it.
How could I do this?
I have two variables:
TimeSpan horaI = new TimeSpan(10, 00, 00);
TimeSpan horaF = new TimeSpan(22, 00, 00);
I need to display them on the screen as follows 10:00 AM and 10:00 PM. But I can not do it.
How could I do this?
You can do this as follows:
var horaI = new TimeSpan(10, 00, 00);
var horaFormatada = string.Format("{0:hh\:mm}", horaI);
Of course there are several other ways to do this.
Source: link