Foros Club Delphi

Foros Club Delphi (https://www.clubdelphi.com/foros/index.php)
-   Varios (https://www.clubdelphi.com/foros/forumdisplay.php?f=11)
-   -   Calculando una fecha con IncMonth (https://www.clubdelphi.com/foros/showthread.php?t=74613)

gsilvei 28-06-2011 22:14:45

Calculando una fecha con IncMonth
 
Hola amigos,
tengo un pequeño problema q no estoy consiguiendo entender,
tengo dos campos: fecha inicial y otro fecha final,
al fecha inicial le IncMonth, 12, y el resultado lo coloca en el campo fecha final, hasta ahi todo correcto,
solo que si quiero alterar la fecha final al salvar, no salva la fecha que altere
gracias

marcoszorrilla 28-06-2011 22:21:37

Sobre qué aplicas IncMonth, sobre un campo de una base de datos?

Tendrás que hacer un "Post", para salvar los cambios. Pero si estás trabajando con otro componente Monthcalendar, TDAteTimePicker.... entonces el valor de este componente u otro tendrás que trasladarlo campo y luego hacer Post.

Código Delphi [-]
Edit;
CampoFecha.Value:=TDateTimePicker.Date;
Post;

Un Saludo.

gsilvei 28-06-2011 22:34:23

ambos campos son de una base de datos.

Código Delphi [-]
procedure TFormPropostaApolice.INICIALExit(Sender: TObject);
var Data : tdatetime;
begin
  Data := INICIAL.Value;
  Data := IncMonth(Data,12);
  FINAL.Value:= Data;
end;

gsilvei 01-07-2011 05:41:33

Hola,
Alguien tiene alguna idea?
Gracias

gsilvei 01-07-2011 07:04:22

Resolvido a la fuerza bruta.

Código Delphi [-]
var    Data : tdatetime;

  if P_FINVIGENCIA.Enabled = False then
    begin
     Data := P_INIVIGENCIA.Value; 
     Data := IncMonth(Data,12);
     P_FINVIGENCIA.Value:= Data;
    end
    else
    if P_FINVIGENCIA.Enabled = True then
    Data := P_FINVIGENCIA.Value;


La franja horaria es GMT +2. Ahora son las 13:04:10.

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