Ver Mensaje Individual
  #4  
Antiguo 02-05-2019
cloayza cloayza is offline
Miembro
 
Registrado: may 2003
Ubicación: San Pedro de la Paz, Chile
Posts: 913
Reputación: 22
cloayza Tiene un aura espectacularcloayza Tiene un aura espectacular
Estimado OscaraC, aun se puede utilizar el LongFormatDate u otras...

Me tomé la libertad de agregar unas líneas al código que propuso el colega Casimiro Notevi
Existe la variable global FormatSettings, que está en la unit System.SysUtils, acá puede personalizar todo lo referente a formatos a utilizar en su aplicación.

Código Delphi [-]
...
  OldFormat:string;
 begin
      myDate := StrToDate('20/12/2000');

      {1: Formato por defecto...}
      OldFormat:=FormatSettings.ShortDateFormat;
      {2: Cambio de formato...}
      FormatSettings.ShortDateFormat:='yyyy.mm.dd';

      // Now add a month to this value
      myDate := IncMonth(myDate);

      // And let us see what we get
      DecodeDate(myDate, myYear, myMonth, myDay);
      ShowMessage('myDate now = '+DateToStr(myDate));
      ShowMessage('myDay      = '+IntToStr(myDay));
      ShowMessage('myMonth    = '+IntToStr(myMonth));
      ShowMessage('myYear     = '+IntToStr(myYear));

      {3: Restaura formato por defecto...}
      FormatSettings.ShortDateFormat:=OldFormat;

end;

Saludos cordiales
Responder Con Cita