Ver Mensaje Individual
  #2 (permalink)  
Antiguo 22/07/2010, 10:35
cristianp87
 
Fecha de Ingreso: noviembre-2009
Mensajes: 21
Antigüedad: 14 años, 5 meses
Puntos: 1
Respuesta: Control para seleccionar hora

yo le aconsejaria usar este codigo que funciona esta en C#, consta de 4 textbox los cuales son:
un textbox de horas, otro de minutos, otro de segundos, y el de respuesta, tambien hay un boton el cual une estos parametros en un datetime el codigo es el siguiente:


protected void Button1_Click(object sender, EventArgs e)
{
string hora = TextBox1.Text;
string minutos = TextBox2.Text;
string segundos = TextBox3.Text;
DateTime horas;
int nAdd = 2000;
string fecha2 = string.Format(hora + minutos + segundos);
if (fecha2.Length <= 6)
{
horas = new DateTime(nAdd + 01, 01, 01, Convert.ToInt32(fecha2.Substring(0, 2)), Convert.ToInt32(fecha2.Substring(2, 2)), Convert.ToInt32(fecha2.Substring(4, 2)));
// en este textbox muestra el resultado
TextBox4.Text = "hora/minuto/segundo->" + horas.ToString("hh:mm:ss") + Environment.NewLine;
}

}


espero le sirva,