Howdy, Stranger!

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

Categories

person's age

rs51rs51 Member Posts: 2
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 Member Posts: 231
    : 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]

  • Justin BibJustin Bib USAMember Posts: 0

    _ | http://forcoder.org | free video tutorials and ebooks about / C Swift Python Delphi PL/SQL Go Objective-C JavaScript C++ MATLAB PHP Visual Basic .NET Perl Scratch Visual Basic C# Assembly Ruby Java R Awk Hack Bash Julia Crystal Kotlin FoxPro LabVIEW Logo ABAP Alice Apex D Erlang COBOL Lua Scala Fortran SAS Clojure Scheme Transact-SQL VBScript Prolog Ada Dart F# ML Lisp Rust / _____

Sign In or Register to comment.