I have two function to get a date format. The different is dd-mm-yyyy
and yyyy-mm-dd
format. Currently the 1st function style is 12-3-2020
. So how to make the month is including 0
just like this 12-03-2020
and 2nd style to be as 2020-03-13
.
Below are the functions.
function displayDate(input_date){
proc_date = new Date(input_date)
year = proc_date.getYear() + 1900
month = proc_date.getMonth() + 1
day = proc_date.getDate()
return day +"-"+ month +"-"+ year;
}
function sendDate(input_date){
proc_date = new Date(input_date)
year = proc_date.getYear() + 1900
month = proc_date.getMonth() + 1
day = proc_date.getDate()
return year +"-"+ month +"-"+ day;
}