/    Sign up×
Community /Pin to ProfileBookmark

Get Age From Date

I know is javascript but could anyone help me convert to php so i dont have to use a form?

[CODE]<SCRIPT LANGUAGE=”JavaScript”>

var show_time=true;
function birthdate() {
var today=new Date();
var curyear=today.getYear()
if (curyear < 1000)
curyear+=1900
writeyourAge()
}
function writeyourAge() {
TheDate = new Date();
Month = TheDate.getMonth();
Day = TheDate.getDate();
Year = TheDate.getYear();
if (Year< 1000)
Year+=1900
by = “{listing_field_doby_value}”;
bm = “{listing_field_dobm_value}”;
bd = “{listing_field_dobd_value}”;
BDate = Date.UTC(by,bm,bd);
if (Year<2000) {
CDate = Date.UTC(Year,Month,Day);
} else {
CDate = Date.UTC(Year,Month,Day);
}
Age = CDate-BDate + (1000*60*60*24*30);
var mytext = document.my_age.yrs.value = parseInt(((((Age/1000)/60)/60)/24)/365.25,10);

document.write(‘ ‘ + mytext + ‘ ‘);
}
</SCRIPT>[/CODE]

to post a comment
PHP

0Be the first to comment 😎

×

Success!

Help @2let2sell2buy spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.19,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...