Programación General > C++ Builder

 Componente

<< < (3/3)

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] = {&#34;Dom.&#34;,&#34;Lun.&#34;,&#34;Mar.&#34;,&#34;Mier.&#34;,&#34;Juev.&#34;,&#34;Vier.&#34;,&#34;Sab.&#34;};  DecodeDate(dMiFecha, Year, Month, Day); if (Month == 12) {      Year ++;      Month = 0; } dFecha = EncodeDate(Year, Month + 1, (Word)StrToInt(&#34;01&#34;)) - 1; DecodeDate(dFecha, Year, Month, Day); ShowMessage(&#34;útimo día del mes &#34; + StrToDate(dMiFecha) + &#34; es el &#34; + Day + &#34;, y es &#34; + cDias[DayOfWeek(dFecha)];  
Saludos!

Navegación

[0] Índice de Mensajes

[*] Página Anterior

Ir a la versión completa