1
I need to display the value of the TIME attribute only HH:mm (hour and minutes). By including the following masks an error occurs:
The input character string was not in an incorrect format.
I tried it both ways:
@dia.HORAINICIO.ToString(@"hh:mm tt")
@dia.HORAINICIO.ToString("{0:t}")
My Annotation date is as follows:
[Display(Name = "Hora Inicial:")]
[DataType(DataType.Time)]
[DisplayFormat(ApplyFormatInEditMode = true, DataFormatString = "{0:HH:mm}")]
public TimeSpan HORAINICIO { get; set; }
Try it like this: @dia.HORAINICIO.Tostring("hh:mm"); or @dia.HORAINICIO.Tostring("hh:mm:ss"); with seconds.
– Janderson Thomaz