Created
April 13, 2017 11:41
-
-
Save Rameshwar-ghodke/2072b43173de837ce3454dacd19f9311 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var dob = wholedata[4]; | |
if(dob.length==0) | |
{ | |
AgeYear=0; | |
$("#user_age").val(AgeYear); | |
} | |
else | |
{ | |
BirthDate=dob.split("-"); | |
BirthDay=BirthDate[2]; | |
BirthMonth=BirthDate[1]; | |
BirthYear=BirthDate[0]; | |
TodayDate=new Date(); | |
CurrentDay=TodayDate.getDate(); | |
CurrentMonth="0"+parseInt(TodayDate.getMonth()+1); | |
CurrentYear=TodayDate.getFullYear(); | |
AgeDay=CurrentDay-BirthDay; | |
AgeMonth=CurrentMonth-BirthMonth; | |
AgeYear=CurrentYear-BirthYear; | |
if(AgeMonth < 0 || (AgeMonth==0 && AgeDay < 0)) | |
{ | |
AgeYear=parseInt(AgeYear)-1; | |
} | |
else | |
{ | |
AgeYear=parseInt(AgeYear); | |
} | |
$("#user_age").val(AgeYear); | |
} |
Author
Rameshwar-ghodke
commented
Apr 13, 2017
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment