TimeSpan

tehadm

Администратор
Сообщения
1 159
Реакции
293
C#:
TimeSpan ts = TimeSpan.Parse("12:14");
int hours = ts.Hours;
int minutes = ts.Minutes;

C#:
TimeSpan ts;
if (TimeSpan.TryParse("12:99", out ts))
{
    // the string is a valid time, use it
}
else
{
    // the string is not a valid time, handle that scenario
}
 
Назад
Верх Низ