I have code like this
<script language="javascript" type="text/javascript">
function getdate() {
var tt = document.getElementById('txtDate').value;
var ct = document.getElementById('package').value;
var date = new Date(tt);
var newdate = new Date(date);
newdate.setDate(newdate.getDate() + ct);
var mm = newdate.getMonth()+1;
var dd = newdate.getDate();
var yyy = newdate.getFullYear();
var someFormattedDate = mm + '/' + dd + '/' + yyy;
document.getElementById('EndDate').value = someFormattedDate;
}
</script>
<div class="form-group">
<label>Start Tour</label>
<input type="date" id="txtDate" name="start_date" required>
</div>
<p></p>
<label> Ending Tour</label>
<input type="text" id="EndDate" name="end_date" required>
<label>Nama Package</label>
<select class="form-control" id="package" name="package" onChange="getdate()">
<option value= disabled>--Pilih Package Tour--</option>
<?php
$sql = mysql_query("select * from package");
while ($lihat = mysql_fetch_array($sql)) {
?>
<option value="<?php echo $lihat['lama_hari']; ?>"><?php echo $lihat['nama_package'] ?></option>
<?php } ?>
</select>
When I run this code, I get the following result:

Why do I get this date in Ending Tour?
I count add date with the value from database of nama package, the value is 1 in database.
The result should be 09/03/2016, not 09/21/2016
I have no idea why the result becomes like that. I'm beginner here.
xnumber of days to the date selected by the user wherexis the value of<select id="package">?document.getElementById('EndDate').value = someFormattedDate;in your code thats why theEnding Tourhas a value