I have build this function:
function currentDate() { var date; var currentDate = new Date(); var day = currentDate.getDate(); var month = currentDate.getMonth() + 1; var year = currentDate.getFullYear(); // if the month length = 1 add "0" to ir if (currentDate.getMonth().toString().length == 1) { month.toString(); month = "0" + month; } // if the day length = 1 add "0" to ir if (currentDate.getDate().toString().length == 1) { day.toString(); day = "0" + day; } var ISO = year + "-" + month + "-" + day; var EUR = day + "/" + month + "/" + year; return date = { "ISO": ISO, "EUR": EUR }; } When I click on a button I want the ISO date or the EUR date to be passed into a text input. How can this be done???
Thank you..
return { "ISO": ISO, "EUR": EUR };. No need fordate =, especially as you don't even usedate.