You are here: irt.org | FAQ | JavaScript | Date | Q1451 [ previous next ]
Try:
<script language="JavaScript"><!-- function Monday(yyyy,mm,dd) { mm -= 1; // JavaScript months start at 0 theDate = new Date(yyyy,mm,dd); daynumber = theDate.getDay(); // 0 = monday, 6 = sunday if (daynumber > 0) daynumber-=1; else daynumber += 6; // Previous week... adjust = daynumber*1000*60*60*24; theMonday = new Date(theDate.getTime() - adjust); return theMonday.toString(); } alert(Monday(1999,04,11)); //--></SCRIPT>