-3

Im looking for an answer where I could type a date using HTML tag input type = "date" name = "Date_issued", then it will automatically compute and display it in another HTML tag input type = "date" name = "Date_expiry" with the formula of Date_issued + 5years using javascript. It's all about a passport expiry. I'm really hoping to had a answer to this and thanks for the help.

Marty McVry
  • 2,838
  • 1
  • 17
  • 23

1 Answers1

0

This javascript should get you going.

var d = new Date('2013-09-23'); // The date "issued"
d.setYear(d.getFullYear() + 5); // Add 5 years
document.write(d);
Alasjo
  • 1,240
  • 8
  • 17
  • How could i make it yyyy-mm-dd format? dont know the syntax could you also give me a set of video tutorial for javascript? this is much sorry :) but thanks – user2806957 Sep 23 '13 at 12:14
  • http://stackoverflow.com/questions/1056728/formatting-a-date-in-javascript – Alasjo Sep 25 '13 at 07:51