/ Published in: JavaScript
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
var currentTime = new Date() var month = ("0" + (currentTime.getMonth() + 1)).slice(-2) var day = currentTime.getDate() var year = currentTime.getFullYear() //insert into form var frm = document.getElementById('contact-form'); frm.dater.value = (year + "-" + month + "-" + day)