Hi all i am trying to display tomorrow date and time(8am) in my date field. as i have tried some code
it is showing only tomorrow date but not time can any one help me how to show time 8am as by default
Here is my code:
<div class="col-xs-6 date" style="display:none;">
<input class="form-control" type="date" id="inputDate"/>
</div>
<script>
// Declare variables
var tomorrow = new Date(new Date().getTime() + 24 * 60 * 60 * 1000);
// Set values
$("#inputDate").val(getFormattedDate(tomorrow));
// Get date formatted as YYYY-MM-DD
function getFormattedDate (date) {
return date.getFullYear()
+ "-"
+ ("0" + (date.getMonth() + 1)).slice(-2)
+ "-"
+ ("0" + date.getDate()).slice(-2);
}
</script>
Can anyone help me how can i display time as by default 8 am and later if user want to change they can change their date and time according to their requirement.
Thanks in advance
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…