dd/mm/yyyy format in javascript code example
Example 1: js date format yyyy-mm-dd
yourDate.toISOString().split('T')[0]
Example 2: convert date format from yyyy-mm-dd to dd-mm-yyyy using value javascript
date.value.split("-").reverse().join("-");
Example 3: javascript date format mm/dd/yyyy
var date_format = new Date();
document.write(innerHTML = date_format.getMonth()+'/'+ date_format.getDate()+'/'+date_format.getFullYear());
Example 4: get date format javascript
const handleDate = (dataD) => {
let data= new Date(dataD)
let month = data.getMonth() + 1
let day = data.getDate()
let year = data.getFullYear()
if(day<=9)
day = '0' + day
if(month<10)
month = '0' + month
const postDate = year + '-' + month + '-' + day
return postDate
}