Howdy, Stranger!

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

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

person's age

rs51rs51 Posts: 2Member
I want to return a person's age, in years, given the birth date. I have a text box where the age lies:
text1.text = 24.2.89
And i want to retrieve her age.
The code i'm using returns stupid ages (ex: -354)
Here goes my code:
Label1.Caption = Int(DateDiff("y", CDate(Text1.Text), Date) / 365.25)
Can anyone help, please?

Comments

  • JomacJomac Posts: 231Member
    : I want to return a person's age, in years, given the birth date. I have a text box where the age lies:
    : text1.text = 24.2.89
    : And i want to retrieve her age.
    : The code i'm using returns stupid ages (ex: -354)
    : Here goes my code:
    : Label1.Caption = Int(DateDiff("y", CDate(Text1.Text), Date) / 365.25)
    : Can anyone help, please?
    :

    It works fine, just a type mismatch
    try entering date like:
    [code]
    24 Feb 1989 or 24/2/89
    [/code]

    Regards,

    ______
    [size=2][b][blue]J[/blue]omac.[/b][/size]

Sign In or Register to comment.