Search Results

Search found 1 results on 1 pages for 'user2768038'.

Page 1/1 | 1 

  • Update someones birthday with javascript

    - by user2768038
    So far the only mathematical way I can think of doing it is this: var age = 18 var today = new Date(); var myDate = new Date(); myDate.setFullYear(2013,3,13); /* My birthday is april 13th */ var y = (today - myDate); var days = ( y / (1000*60*60*24)); if(days >= 360){ var age = age +1; } if(days >= 720){ var age = age +1; } //etc...... document.write(age); Is there a better way of doing the if statements? so that I don't have to write one out for every year? I can't think!

    Read the article

1