Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Dates and calculations

cjolleyscjolleys Member Posts: 14
I have the following piece of code:

if (array[i].dofb+ ?? )<date then
begin
MessageDlg('This person is not old enough to join yet!',MtWarning,[mbOK],0);
form2.visible:=false;
end;

but i'm not sure what to put in where i have the question marks!! I basically want to calculate if a person is at least seven on today's date, and I have no idea what number to put there - it's very randomthe way it works i think!!

Cj

Comments

  • FactorSoftwareFactorSoftware Member Posts: 19
    Try this:

    [code]
    procedure TForm1.Button1Click(Sender: TObject);
    var
    y,m,d : word;
    begin
    decodedate(((now - strtodate('17-11-79'))- 693594.0),y,m,d);
    showmessage('Years old: ' + inttostr(y) +#13+
    'Months old: ' + inttostr(m) +#13+
    'Days old: ' + inttostr(d));
    end;
    [/code]

    This piece of code will subtract from the current date a date that is given by you, or any other user, and finaly subtracts the number [red]693594.0.[/red]
    The number 693594.0 is the number of days in 1900 years.
    [red]If you don't subtract this number, base date will always be 1900![/red]

    I hope that this can solve your problem!
    Bye... ;-)

    : I have the following piece of code:
    :
    : if (array[i].dofb+ ?? )<date then
    : begin
    : MessageDlg('This person is not old enough to join yet!',MtWarning,[mbOK],0);
    : form2.visible:=false;
    : end;
    :
    : but i'm not sure what to put in where i have the question marks!! I basically want to calculate if a person is at least seven on today's date, and I have no idea what number to put there - it's very randomthe way it works i think!!
    :
    : Cj
    :

Sign In or Register to comment.