Reputation: 23
var today = new Date();
var tomorrow = today;
tomorrow.setDate(tomorrow.getDate() +1);
function formatDateToString(date) {
var dd = (date.getDate() < 10 ? '0' : '')
+ date.getDate();
return dd;
}
how can I store and use the return value in a variable?
Upvotes: 0
Views: 4249
Reputation: 11
Since the function is returning a value you can assign the returned value to the variable like this:
var returned = formatDateToString(date);
Upvotes: 1