Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Date Functions
#1
Solved: 11 Years, 4 Months ago
I have any birth date. For example 04/07/1973 I would like to take the current date - any birth date and get the person's current age. Is there a function I can use? For example 07/29/2008 - 04/07/1973 = 35
Thanks,
Anna
Reply
#2
Solved: 11 Years, 4 Months ago
Check this , i hope it's usefull for u

Code:
strBirthDate="10/10/2000"
vmonth = dateDiff("m",strBirthDate, date())
vday= datediff("d", strBirthDate, date())
If month(Now()) > month(strBirthDate)  OR month(Now()) = month(strBirthDate) Then
     If day(strBirthDate) = day(Now()) OR Day(Now()) > day(strBirthDate)Then
          vyear = DateDiff("y", year(strBirthDate), year(Now()))
    else
        vyear = DateDiff("y", year(strBirthDate), year(Now())) - 1    
    end if
    
else
       vyear = DateDiff("y", year(strBirthDate), year(Now())) - 1
End If

msgbox "Year::"& vyear
Reply
#3
Solved: 11 Years, 4 Months ago
Hi,
This seems to work well. Thank you!
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Perform some functions whenever QTP Stop button is pressed smartkarthi 2 3,215 08-22-2013, 11:43 AM
Last Post: smartkarthi
  exit parent functions as well Shridevi.Salagare 3 3,853 07-31-2013, 12:15 AM
Last Post: Ankur
  Datatable in functions shwetasharma 2 3,510 03-26-2013, 08:00 AM
Last Post: sams001
  Problem with using two functions in the same action mhanaan 2 3,042 09-14-2012, 10:09 PM
Last Post: mhanaan
  Need Help Datatable Parameterzing Date debindas 1 3,673 08-30-2012, 11:43 PM
Last Post: QTPScript

Forum Jump:


Users browsing this thread: 1 Guest(s)