You are not logged in.
Pages: 1
using Html / PHP :
i have two textbox i want to insert date in the first textbox and when inserting the date the second textbox will be filled automatically with the date of the first textbox + 10 years.
Example :
Start Date: 01/01/2014 (When filling here)
automatically ---->End Date: 01/01/2024
Sorry guys but im new to php and html... i work in a small company and im trying to create a small application but i have this small problem. thanks in advance.
check this and see if it helps.
http://stackoverflow.com/questions/5172 … -timestamp
as mentioned from the guys, you should do it in Javascript
Last edited by rtp (July 22 2014)
See if this peace of Code Helps You and Good Luck With your Application
<!DOCTYPE html>
<html>
<head>
<script>
function myFunction()
{
var x=document.getElementById("fname");
var y=document.getElementById("fname2");
var d = new Date(x.value);
y.value=((d.getMonth()+1)+"-"+d.getDate() + "-" +(d.getFullYear()+10));
}
</script>
</head>
<body>
<input type="date" id="fname" onchange="myFunction()">
<input type="text" id="fname2" disabled>
</body>
</html>
Last edited by AliMJD (July 21 2014)
You don't need PHP to do that, you can use JavaScript. This is a nice JS library that handles dates and times: momentjs.com
Thanks Guys! I Really appreciate it !
Pages: 1