Exemplo n.º 1
0
		private void ConvertHours()
		{
			int posTo = ToString.IndexOf(':');
			int posFrom = FromString.IndexOf(':');
			int toHour = 0, toMinute = 0, fromHour = 0, fromMinute = 0;

			if (posTo == -1)
			{
				int.TryParse(ToString, out toHour);
			}
			else
			{
				int.TryParse(ToString.Substring(0, posTo), out toHour);
				int.TryParse(ToString.Substring(posTo + 1), out toMinute);
			}

			if (posFrom == -1)
			{
				int.TryParse(FromString, out fromHour);
			}
			else
			{
				int.TryParse(FromString.Substring(0, posFrom), out fromHour);
				int.TryParse(FromString.Substring(posFrom + 1), out fromMinute);
			}

			To = new DateTime(1900, 1, 1, toHour, toMinute, 0);
			From = new DateTime(1900, 1, 1, fromHour, fromMinute, 0);
		}