I have a sample code:
$("#curday").click(function () { var newdate; date = new Date(); newdate = date.getDate() + '.' + date.getMonth() + '.' + date.getFullYear(); $("#datepicker_down").val(newdate); });
But I have problems with him.
- The month begins the withdrawal from scratch, that is, I now have the 7th month, and not the 8th, how to fix it?
- The date output format is as follows: 07/20/2012, but I want to get this: 07/20/2012, that is, if the number and the month have 1 digit, then the automaton added a zero ahead.
Please help in these nuances. Thank you in advance.