views:

47

answers:

1

Uusing PHP and ASP on a project. A form in PHP captures the day, month and year of a birth date. Then it's inserted into a database as the variable currentSeconds. I can get the years from variable $currentSeconds in PHP no problem using the 2nd code snippet

1st Code Snippet

$day=$_POST[day];
if ($day<10){
$day="0".$day;
}

$currentSeconds = strtotime($day." ".$_POST[month]." ".$_POST[year]);

2nd Code Snippet

$nYears = date('Y',time()-$currentSeconds)-1970;

How can I get the number of years using $currentSeconds variable, but under classic ASP? For this example $currentSeconds = 136612800, which should give the number of years as 36.

Thanks in advance

A: 

i dont get what you are doing there but if you want to calc the difference between 2 dates you could use DateDiff function in classic asp

nYears = DateDiff("yyyy", birthdate, now)
ulluoink