javascript - Change dateformat output -


i facing annoying problem in code.

i wanna have output date this:

06/04/2014

document.getelementbyid("nights").value = diff + " nights"; {     $('#arrival').datepicker().val();     $('#departure').datepicker().val();     var start = new date(document.getelementbyid('arrival').value),         end = new date(document.getelementbyid('departure').value),         currentdate = new date(start),         between = [];      while (end > currentdate) {         between.push(new date(currentdate));         currentdate.setdate(currentdate.getdate() + 1);     }      $('#lista').html(between.join('<br> ')); }; 

where can change output format?

in while loop, try:

while (end > currentdate) {     var month = currentdate.getmonth() + 1;     var day = currentdate.getdate();     var year = currentdate.getutcfullyear();     between.push(month + '-' + day + '-' + year);     currentdate.setdate(currentdate.getdate() + 1); } 

it looks doing many more of these: new date(variable) necessary.


Comments

Popular posts from this blog

c# - Unity IoC Lifetime per HttpRequest for UserStore -

Change the color of an oval at click in Java AWT -

I am trying to solve the error message 'incompatible ranks 0 and 1 in assignment' in a fortran 95 program. -