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

PHPMotion implementation - URL based videos (Hosted on separate location) -

javascript - Using Windows Media Player as video fallback for video tag -

c# - Unity IoC Lifetime per HttpRequest for UserStore -