Programación General > C++ Builder
Componente
The Black Boy:
lordford y esa instruccion no me puede devolver solo la fecha..
es que la hora no la veo tan necesaria mejor dicho no necesito la hora...
Gracias y Saludos :hola:
ChangSoft:
A tienes uan maera facil de hacer lo que buscas no es necesario ningun .h:
CODIGO
//---------------------------------------------------------------------------
void __fastcall TForm1::Button1Click(TObject *Sender)
{
Label1->Caption=TimeToStr(Time());
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button2Click(TObject *Sender)
{
Label2->Caption=DateTimeToStr(Date());
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button3Click(TObject *Sender)
{
Label3->Caption=DateTimeToStr(Date())+" "+TimeToStr(Time());
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Timer1Timer(TObject *Sender)
{
Label4->Caption=TimeToStr(Time());
}
//---------------------------------------------------------------------------
void __fastcall TForm1::FormActivate(TObject *Sender)
{
Label4->Caption=TimeToStr(Time());
}
//---------------------------------------------------------------------------
Necesitas:
4 Labels
3 Button
1 Timer (System)
Suerte
The Black Boy:
Gracias Por todas las respuestas que me han dado
Saludos :hola:
_Viktor:
Para saber a que dia de la semana corresponde determinada fecha, puedes hacer algo como lo siguiente:
Suponiendo que la fecha la tego guardada en una variable dMiFecha, yo lo haría así:
--- Código: Text ---Word Year, Month, Day; TDateTime dFecha; AnsiString cDias[7] = {"Dom.","Lun.","Mar.","Mier.","Juev.","Vier.","Sab."}; DecodeDate(dMiFecha, Year, Month, Day); if (Month == 12) { Year ++; Month = 0; } dFecha = EncodeDate(Year, Month + 1, (Word)StrToInt("01")) - 1; DecodeDate(dFecha, Year, Month, Day); ShowMessage("útimo día del mes " + StrToDate(dMiFecha) + " es el " + Day + ", y es " + cDias[DayOfWeek(dFecha)];
Saludos!
Navegación
[*] Página Anterior
Ir a la versión completa