Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
420 B
2
Indexable
Never
<script>
    const dateInput = document.getElementById('as_on_date');
const currentDate = new Date();
const year = currentDate.getFullYear();
const month = ('0' + (currentDate.getMonth() + 1)).slice(-2); // add leading zero and slice last two characters
const day = ('0' + currentDate.getDate()).slice(-2); // add leading zero and slice last two characters
dateInput.value = `${day}-${month}-${year}`;
  </script>