RE: [OT] Programming Challenge

2003-01-24 Thread Stuart Jameson
Not sure that the algorithm 'randomly' calculates the date but here you
go

http://www.dennisglass.com/javascript02.html



> -Original Message-
> From: Mark Galbreath [mailto:[EMAIL PROTECTED]] 
> Sent: 24 January 2003 15:16
> To: struts
> Subject: [OT] Programming Challenge
> 
> 
> 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:struts-user-> [EMAIL PROTECTED]>
> For 
> additional commands, 
> e-mail: <mailto:[EMAIL PROTECTED]>
> 
> 

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




RE: [OT] Programming Challenge

2003-01-24 Thread Mark Galbreath
Yeah, I was using http://javascript.internet.com/calendars/ but got tired of
reading source.  I deserve this.

-Original Message-
From: James Turner [mailto:[EMAIL PROTECTED]] 
Sent: Friday, January 24, 2003 10:24 AM

Search engines: Know them, use them.



--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




RE: [OT] Programming Challenge

2003-01-24 Thread Andrew Hill
umm


var dayOfWeek = c.getDay();


Nope.
Posting it here got him the answer quicker - and without the 50 tons of
nonsense around the one line of interest :-)
...search engines can never compete with struts users who are easily
distracted by [OT] challenges...

-Original Message-
From: James Turner [mailto:[EMAIL PROTECTED]]
Sent: Friday, 24 January 2003 23:24
To: 'Struts Users Mailing List'
Subject: RE: [OT] Programming Challenge


> From: Mark Galbreath [mailto:[EMAIL PROTECTED]]
> Sent: Friday, January 24, 2003 10:16 AM
> To: struts
> Subject: [OT] Programming Challenge
>
>
> 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

Well, if you want to randomly calculate the day of the week, rand(7)
sounds like a good start :-)

If you'd like to *deterministically* determine the day of the week, try:

http://javascript.internet.com/calculators/day-of-week.html

Search engines: Know them, use them.

James Turner
Owner & Manager, Black Bear Software, LLC
[EMAIL PROTECTED]

Author:
MySQL & JSP Web Applications:
Data Driven Programming Using Tomcat and MySQL
ISBN 0672323095; Sams, 2002

Co-Author:
Struts Kick Start
ISBN 0672324725; Sams, 2002

Forthcoming:
JavaServer Faces Kick Start
Sams, Fall 2003




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


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




RE: [OT] Programming Challenge

2003-01-24 Thread Mark Galbreath
Man, do I feel like a dumbass!  RTFM the API, Mark!!!

Thanks, Brian!

-Original Message-
From: Brian Lee [mailto:[EMAIL PROTECTED]] 
Sent: Friday, January 24, 2003 10:24 AM

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



--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




Re: [OT] Programming Challenge

2003-01-24 Thread Gemes Tibor
2003. január 24. 16:16 dátummal Mark Galbreath ezt írtad:
> 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.

d = new Date('October 02, 2003');
var weekday=new 
Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday");

alert(d.getDay()+ ': ' + weekday(d.getDay() );

Hth,

Tib

--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




RE: [OT] Programming Challenge

2003-01-24 Thread James Turner
> From: Mark Galbreath [mailto:[EMAIL PROTECTED]] 
> Sent: Friday, January 24, 2003 10:16 AM
> To: struts
> Subject: [OT] Programming Challenge
> 
> 
> 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

Well, if you want to randomly calculate the day of the week, rand(7)
sounds like a good start :-)

If you'd like to *deterministically* determine the day of the week, try:

http://javascript.internet.com/calculators/day-of-week.html

Search engines: Know them, use them.

James Turner
Owner & Manager, Black Bear Software, LLC
[EMAIL PROTECTED]

Author: 
MySQL & JSP Web Applications: 
Data Driven Programming Using Tomcat and MySQL
ISBN 0672323095; Sams, 2002

Co-Author: 
Struts Kick Start
ISBN 0672324725; Sams, 2002

Forthcoming:
JavaServer Faces Kick Start 
Sams, Fall 2003




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




Re: [OT] Programming Challenge

2003-01-24 Thread Brian Lee
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 -
Received: (qmail 23186 invoked by uid 98); 24 Jan 2003 15:18:12 -
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" 
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]>



RE: [OT] Programming Challenge

2003-01-24 Thread Andrew Hill
And if you want an underlying algorithm you could check out the source to
Rhino - which probably just uses the java classes - so you could go check
their source, but Im thinking you just want a quick solution

...what with it being Friday morning and a long tedious day ahead before you
can relax ;-)

-Original Message-
From: Andrew Hill [mailto:[EMAIL PROTECTED]]
Sent: Friday, 24 January 2003 23:20
To: Struts Users Mailing List
Subject: RE: [OT] Programming Challenge


var bob = new Date(...
var dayOfWeek = bob.getDay(); //what day is it here
var utcDayOfWeek = bob.getUTCDay(); //what day it is in merry old England
right now

returns 0 for Sunday , etc...



-Original Message-
From: Mark Galbreath [mailto:[EMAIL PROTECTED]]
Sent: Friday, 24 January 2003 23:16
To: struts
Subject: [OT] Programming Challenge


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]>


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


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




RE: [OT] Programming Challenge

2003-01-24 Thread Andrew Hill
var bob = new Date(...
var dayOfWeek = bob.getDay(); //what day is it here
var utcDayOfWeek = bob.getUTCDay(); //what day it is in merry old England
right now

returns 0 for Sunday , etc...



-Original Message-
From: Mark Galbreath [mailto:[EMAIL PROTECTED]]
Sent: Friday, 24 January 2003 23:16
To: struts
Subject: [OT] Programming Challenge


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]>


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




RE: [OT] Programming Challenge

2003-01-24 Thread Pani, Gourav
dunno.  but i have an 8 year old cousin who does that crap all the time in
his head.  never know when he is lying.  so the code would be helpful to
figure that stuff out.

-Original Message-
From: Mark Galbreath [mailto:[EMAIL PROTECTED]]
Sent: Friday, January 24, 2003 10:16 AM
To: struts
Subject: [OT] Programming Challenge


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]>

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




[OT] Programming Challenge

2003-01-24 Thread Mark Galbreath
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:   
For additional commands, e-mail: