DateTime e Integer
Alguém poderia me ajudar com um pequeno probleminha...? Estou tentando fazer uma soma de dois campos de uma tablea com o Delphi, um campo do tio Date e outro do tipo Integer. Preciso agendar uma data automaticamente, ou seja, insiro uma data inicial de agendamento e se a data for menor que o dia de hoje, por exemplo, é hora de atualizar! Então tenho que somar essa data inicial com um campo de intervalo e atribuir o resultado a um outro campo: Data_Agenda. Como faço isso?!!!
Obrigado!
[b:2dc613fa74]Título editado. Por favor, leia as regras de conduta.[/b:2dc613fa74]
Obrigado!
[b:2dc613fa74]Título editado. Por favor, leia as regras de conduta.[/b:2dc613fa74]
Michaell
Curtidas 0
Respostas
Lcquinhone
01/11/2003
Extraia da data Dia, Mes e Ano some o dia + valor e depois converta em data de novo
GOSTEI 0
Michaell
01/11/2003
Ainda encontro dificuldades... por gentileza, teria como você exmplificar em código?!
Obrigado!
Obrigado!
GOSTEI 0
Adilsond
01/11/2003
Veja no Help informações sobre o campo TDateTime.
TDateTime type
TDateTime is a used by the date and time routines to hold date and time values.
Unit
System
type TDateTime = type Double;
Description
Most VCL objects represent date and time values using the TDateTime type. [u:ede45a168b]The integral part of a TDateTime value is the number of days that have passed since 12/30/1899. The fractional part of a TDateTime value is fraction of a 24 hour day that has elapsed[/u:ede45a168b].
Following are some examples of TDateTime values and their corresponding dates and times:
012/30/1899 12:00 am
2.751/1/1900 6:00 pm
-1.2512/29/1899 6:00 am
350651/1/1996 12:00 am
To find the fractional number of days between two dates, simply subtract the two values. Likewise, to increment a date and time value by a certain fractional number of days, simply add the fractional number to the date and time value.
Note:Delphi 1.0 calculated the date from year 1 instead of from 1899. To convert a Delphi 1.0 date to a Delphi 2.0 date, subtract 693594.0 from the Delphi 1.0 date. The date format changed to be more compatible with OLE 2.0 Automation.
Ou seja:
CampoData := CampoData + CampoInteiro;
TDateTime type
TDateTime is a used by the date and time routines to hold date and time values.
Unit
System
type TDateTime = type Double;
Description
Most VCL objects represent date and time values using the TDateTime type. [u:ede45a168b]The integral part of a TDateTime value is the number of days that have passed since 12/30/1899. The fractional part of a TDateTime value is fraction of a 24 hour day that has elapsed[/u:ede45a168b].
Following are some examples of TDateTime values and their corresponding dates and times:
012/30/1899 12:00 am
2.751/1/1900 6:00 pm
-1.2512/29/1899 6:00 am
350651/1/1996 12:00 am
To find the fractional number of days between two dates, simply subtract the two values. Likewise, to increment a date and time value by a certain fractional number of days, simply add the fractional number to the date and time value.
Note:Delphi 1.0 calculated the date from year 1 instead of from 1899. To convert a Delphi 1.0 date to a Delphi 2.0 date, subtract 693594.0 from the Delphi 1.0 date. The date format changed to be more compatible with OLE 2.0 Automation.
Ou seja:
CampoData := CampoData + CampoInteiro;
GOSTEI 0