Beginner VB

Moderators: None (Apply to moderate this forum)
Number of threads: 1244
Number of posts: 2990

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
person's age Posted by rs51 on 1 May 2002 at 8:10 AM
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?
Report
Re: person's age Posted by Jomac on 28 May 2002 at 5:08 AM
: 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:
24 Feb 1989 or 24/2/89


Regards,

______
Jomac.




 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.