Return to Snippet

Revision: 17886
at September 16, 2009 05:04 by Ozzy


Updated Code
function select_preview_month() {
  var now = new Date(2009,2,1);
  var first_day = new Date(now.getFullYear(), now.getMonth(), 1);
  var last_day  = new Date(now.getFullYear(), now.getMonth(), 0);
  alert(first_day);
  alert(last_day);
  alert(first_day.getDate() + '.' +  first_day.getMonth()  + '.' + first_day.getFullYear());
  alert(last_day.getDate()  + '.' +  first_day.getMonth()   + '.' + last_day.getFullYear());
// first_day.getMonth() is not an error !!!
}

Revision: 17885
at September 16, 2009 04:45 by Ozzy


Initial Code
function select_preview_month() {
            var now = new Date();
            first_day = new Date(now.getFullYear(), now.getMonth(), 1);
            last_day = new Date(now.getFullYear(), now.getMonth(), 0);
            alert(first_day);
            alert(last_day);
          }

Initial URL


Initial Description


Initial Title
Get first and last date of preview month

Initial Tags
date

Initial Language
JavaScript