0 Replies Latest reply: Sep 4, 2012 5:28 AM by 1D10T RSS

    Javascript Date calculations probelm

    1D10T
      Hi , maybe a wrong forum

      I got a problem i need a date what is Today - 7 days i maked
          var date = new Date();
          var twoDigitMonth=((date.getMonth()+1)>=10)? (date.getMonth()+1) : '0' + (date.getMonth()+1);
          var f_date = date.getDate()+"."+twoDigitMonth+"."+date.getFullYear();
      
      
          var f_dateminus7 = date.getDate()-7+"."+twoDigitMonth+"."+date.getFullYear();
      but f_dateminus7 is -3.09.2012 but i needed 28.08.2012 i understanding that this date.getDate()-7 is not correct but how to modify the code for sucess result ?




      ID