Jump to content

muncan

Members
  • Posts

    3
  • Joined

  • Last visited

Everything posted by muncan

  1. var myDate = new Date();myDate.setMonth(myDate.getMonth() + 1);myDate.setDate(myDate.getDate() - 24);alert(myDate.getDate() + '/' + myDate.getMonth() + '/' + myDate.getFullYear());Superb,Seems so obvious now! Sh*t me up when '1/4/2006' alert msg popped up but bit of tweaking and all is well. Thanks again.Muncan.
  2. Thanks for that Raimo,Works a treat!Apart from its one month behind what it should be. Question now is, where do I put the '+ 1' to make it the correct month ?Cheers againMuncan.
  3. Hi,I am creating an elearning system for which the current date is to be displayed in the format DD/MM/YYYY. I also need to include a date 14 days previous to the current date in the same format.Displaying the current date in that format isnt a problem. I can change the date using the code:-<script type="text/javascript">var d = new Date()d.setDate (-14)document.write(d)</script>but this displays the date as 'Tue Apr 11 15:25:22 UTC+0100 2006' .Ive tried this code..<script type="text/javascript">var d=new Date()var day=d.getDate() - 14var month=d.getMonth() + 1var year=d.getFullYear()document.write(year + "/" + month + "/" + day)</script>..but this just deletes 14 off the current day number (which is no ruddy use!!)Please can someone help out...? ThanksMuncan
×
×
  • Create New...