View Single Post
Old 05-17-2004, 06:42 AM  
grannytgp
Confirmed User
 
Join Date: Aug 2002
Posts: 269
Quote:
Originally posted by mazafaka
<s.c.r.i.p.t.>
function DatePrint(days)
{
var today = new Date();
var theDate = new Date(today.valueOf()-days*86400000);
var day = theDate.getDate();
getmonth = theDate.getMonth();
var monthArray = new Array("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December");
month = monthArray[getmonth];
var ds = '';
if (day < 10)
ds = '0';
document.write(month + " " + ds + day);
}
</s.c.r.i.p.t.>

<s.c.r.i.p.t.>DatePrint(1)</s.c.r.i.p.t.>


-----------------
(1) - means yesterday, (7) - a week ago and so on.
mazafaka - this works great, and with very little code which is a plus Thanks a bunch once again.
grannytgp is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote