Get the current day. Figure out what day of the week it is.
i.e. Today is Jan 24, Fri. Then get the number of days between then and now. Then mod it by 7 to get the number of days to shift. This should all be able to work in JavaScript.

But I think it might be easier to get a JavaScript Date object and use the getDay() method to get the day of the week (0=Sunday).

example:
var myDate = new Date("July 4, 2006");
var iDayOfWeek = myDate.getDay();

You'll find that July 4, 2006 is actually a Tuesday

BAL




From: "Mark Galbreath" <[EMAIL PROTECTED]>
Reply-To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
To: "struts" <[EMAIL PROTECTED]>
Subject: [OT] Programming Challenge
Date: Fri, 24 Jan 2003 10:16:23 -0500
MIME-Version: 1.0
Received: from exchange.sun.com ([192.18.33.10]) by mc4-f22.law16.hotmail.com with Microsoft SMTPSVC(5.0.2195.5600); Fri, 24 Jan 2003 07:17:07 -0800
Received: (qmail 23348 invoked by uid 97); 24 Jan 2003 15:18:14 -0000
Received: (qmail 23186 invoked by uid 98); 24 Jan 2003 15:18:12 -0000
Mailing-List: contact [EMAIL PROTECTED]; run by ezmlm
Precedence: bulk
List-Unsubscribe: <mailto:[EMAIL PROTECTED]>
List-Subscribe: <mailto:[EMAIL PROTECTED]>
List-Help: <mailto:[EMAIL PROTECTED]>
List-Post: <mailto:[EMAIL PROTECTED]>
List-Id: "Struts Users Mailing List" <struts-user.jakarta.apache.org>
Delivered-To: mailing list [EMAIL PROTECTED]
X-Antivirus: nagoya (v4218 created Aug 14 2002)
Message-ID: <005401c2c3bb$8f4cf040$3201a8c0@mgalbreathc810>
X-Priority: 3 (Normal)
X-MSMail-Priority: Normal
X-Mailer: Microsoft Outlook, Build 10.0.4510
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106
Importance: Normal
X-Spam-Rating: 208.185.179.12.available.above.net 1.6.2 0/1000/N
Return-Path: [EMAIL PROTECTED]
X-OriginalArrivalTime: 24 Jan 2003 15:17:07.0809 (UTC) FILETIME=[A8CCCD10:01C2C3BB]

Anybody know the algorithm for randomly calculating the day of the week,
given a particular date? E.g., July 4, 2006 = Wednesday. I need to do this
in JavaScript and for some reason (too much wine last night?) I can't get
brain engaged.

Mark



--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

_________________________________________________________________
Help STOP SPAM with the new MSN 8 and get 2 months FREE* http://join.msn.com/?page=features/junkmail


--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to