Club Delphi  
    FTP   CCD     Buscar   Trucos   Trabajo   Foros

Retroceder   Foros Club Delphi > Principal > OOP
Registrarse FAQ Miembros Calendario Guía de estilo Temas de Hoy

Grupo de Teaming del ClubDelphi

Respuesta
 
Herramientas Buscar en Tema Desplegado
  #1  
Antiguo 01-05-2019
Avatar de oscarac
[oscarac] oscarac is offline
Miembro Premium
 
Registrado: sep 2006
Ubicación: Lima - Perú
Posts: 2.010
Poder: 20
oscarac Va por buen camino
formato de fecha larga en XE7

ya no es posible usar LongDateFormat en XE7 ?

como establezco predeterminadamente la fecha como dd/mm/yyyy
o como puedo hacer un DecodeDate en formato ansi "yyyymmdd"

y que me capture dia, mes y anio ??
__________________
Dulce Regalo que Satanas manda para mi.....
Responder Con Cita
  #2  
Antiguo 01-05-2019
Avatar de Casimiro Notevi
Casimiro Notevi Casimiro Notevi is offline
Moderador
 
Registrado: sep 2004
Ubicación: En algún lugar.
Posts: 32.038
Poder: 10
Casimiro Notevi Tiene un aura espectacularCasimiro Notevi Tiene un aura espectacular
No creo que lo hayan cambiado. Me extraña mucho.
http://www.delphibasics.co.uk/RTL.asp?Name=DecodeDate
Código Delphi [-]
unit Unit1;
 
interface
 
uses
  SysUtils,   // Unit containing the DecodeDate command
  DateUtils,
  Forms, Dialogs;
 
type
  TForm1 = class(TForm)
    procedure FormCreate(Sender: TObject);
  end;
 
var
  Form1: TForm1;
 
implementation
{$R *.dfm}  // Include form definitions
 
procedure TForm1.FormCreate(Sender: TObject);
 var
  myDate : TDateTime;
  myYear, myMonth, myDay : Word;
 begin
  // Set up the myDate variable to have a December 2000 value
  myDate := StrToDate('29/12/2000');

  // 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));
 end;
 
end.
Responder Con Cita
  #3  
Antiguo 01-05-2019
Avatar de Casimiro Notevi
Casimiro Notevi Casimiro Notevi is offline
Moderador
 
Registrado: sep 2004
Ubicación: En algún lugar.
Posts: 32.038
Poder: 10
Casimiro Notevi Tiene un aura espectacularCasimiro Notevi Tiene un aura espectacular
Código Delphi [-]
var
  myDate : TDateTime;
  formattedDate : string;

begin
  myDate := StrToDate('29/02/2000');

  // Display using the default LongDateFormat
  DateTimeToString(formattedDate, 'dddddd', myDate);
  ShowMessage('29/02/2000 using  default = '+formattedDate);

  // Change the display formatting
  LongDateFormat := 'dddd dd of mmmm yyyy';
  DateTimeToString(formattedDate, 'dddddd', myDate);
  ShowMessage('29/02/2000 using override = '+formattedDate);
end;
Responder Con Cita
  #4  
Antiguo 02-05-2019
cloayza cloayza is offline
Miembro
 
Registrado: may 2003
Ubicación: San Pedro de la Paz, Chile
Posts: 913
Poder: 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
Respuesta



Normas de Publicación
no Puedes crear nuevos temas
no Puedes responder a temas
no Puedes adjuntar archivos
no Puedes editar tus mensajes

El código vB está habilitado
Las caritas están habilitado
Código [IMG] está habilitado
Código HTML está deshabilitado
Saltar a Foro

Temas Similares
Tema Autor Foro Respuestas Último mensaje
Capturar fecha larga. Er0s Varios 4 22-09-2010 06:06:22
obtener solo la fecha en formato fecha y sin hora BlueSteel SQL 14 09-05-2008 16:42:19
conversion de fecha texto a fecha formato date shinyi OOP 3 17-12-2007 20:19:49
Como cambiar el formato de un QRSysData en formato fecha Bitbanner Tablas planas 1 13-02-2005 12:33:26
Fecha Larga en Rave servicomp Impresión 3 20-10-2003 01:10:20


La franja horaria es GMT +2. Ahora son las 05:12:34.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi
Copyright 1996-2007 Club Delphi