Author |
Message
|
72dolfan |
Posted: Wed Mar 21, 2007 6:57 am Post subject: Need to calculate Easter Sunday using Calendar Class |
|
|
Acolyte
Joined: 02 May 2006 Posts: 53
|
Hi All,
Was hoping that someone could provide a link or input on how to calculate Easter Sunday using an int Year as input and passing back a Calendar Date.
I've done some google searches but haven't found exactly what I'm looking for.
Thanks in advance!!!
Bill |
|
Back to top |
|
 |
jefflowrey |
Posted: Wed Mar 21, 2007 7:20 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
I guess a naive way to do it would be to construct a Calendar, set(year,Calendar.APRIL,x), and then increment x from 1 until you get(Calendar.DAY_OF_WEEK) == Calendar.SUNDAY _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
72dolfan |
Posted: Wed Mar 21, 2007 7:32 am Post subject: |
|
|
Acolyte
Joined: 02 May 2006 Posts: 53
|
Doesn't Easter sometimes fall in March? |
|
Back to top |
|
 |
jefflowrey |
Posted: Wed Mar 21, 2007 7:33 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
I dunno.
Does Google provide any help for a generic routine for calculating Easter? _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
72dolfan |
Posted: Wed Mar 21, 2007 7:38 am Post subject: |
|
|
Acolyte
Joined: 02 May 2006 Posts: 53
|
I've tried google, but couldn't find anything that made sense or looked like it was somehthing I could use. I was hoping to run across someone on here that has coded something like this, or knows where to find it?
Thanks! |
|
Back to top |
|
 |
jefflowrey |
Posted: Wed Mar 21, 2007 7:59 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
|
Back to top |
|
 |
Michael Dag |
Posted: Wed Mar 21, 2007 12:47 pm Post subject: |
|
|
 Jedi Knight
Joined: 13 Jun 2002 Posts: 2607 Location: The Netherlands (Amsterdam)
|
now all you need to do is translate that into ESQL and post the results here  _________________ Michael
MQSystems Facebook page |
|
Back to top |
|
 |
fjb_saper |
Posted: Wed Mar 21, 2007 12:53 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
Michael Dag wrote: |
now all you need to do is translate that into ESQL and post the results here  |
You mean to say:
Give me the first Sunday after the first full moon after the Spring Equinox ? _________________ MQ & Broker admin |
|
Back to top |
|
 |
jefflowrey |
Posted: Wed Mar 21, 2007 1:13 pm Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
Michael Dag wrote: |
now all you need to do is translate that into ESQL and post the results here  |
ESQL?
72DolFan wants to do this in Java. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
Michael Dag |
Posted: Wed Mar 21, 2007 1:22 pm Post subject: |
|
|
 Jedi Knight
Joined: 13 Jun 2002 Posts: 2607 Location: The Netherlands (Amsterdam)
|
jefflowrey wrote: |
Michael Dag wrote: |
now all you need to do is translate that into ESQL and post the results here  |
ESQL?
72DolFan wants to do this in Java. |
I hadn't concluded that, I was still puzzled by the mods  _________________ Michael
MQSystems Facebook page |
|
Back to top |
|
 |
jefflowrey |
Posted: Wed Mar 21, 2007 1:48 pm Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
Michael Dag wrote: |
I hadn't concluded that, I was still puzzled by the mods  |
it's in the Java/JMS forum, and it's talking about the Calendar class, which is a standard Java class...
As for MOD, there's an ESQL MOD function...
And I guess in Java, the / will do a mod when given ints.
http://java.sun.com/docs/books/jls/second_edition/html/expressions.doc.html#5047 _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
RogerLacroix |
Posted: Thu Mar 22, 2007 8:12 am Post subject: Re: Need to calculate Easter Sunday using Calendar Class |
|
|
 Jedi Knight
Joined: 15 May 2001 Posts: 3264 Location: London, ON Canada
|
|
Back to top |
|
 |
72dolfan |
Posted: Fri Apr 06, 2007 7:39 am Post subject: Re: Need to calculate Easter Sunday using Calendar Class |
|
|
Acolyte
Joined: 02 May 2006 Posts: 53
|
RogerLacroix wrote: |
72dolfan wrote: |
Hi All,
Was hoping that someone could provide a link or input on how to calculate Easter Sunday using an int Year as input and passing back a Calendar Date.
I've done some google searches but haven't found exactly what I'm looking for.
Thanks in advance!!!
Bill |
Google : 'java easter class' returned as the second hit:
http://www.java2s.com/Code/Java/Development-Class/EastercomputethedayonwhichEasterfalls.htm
Works for me.
Regards,
Roger Lacroix |
Thanks for reposnding. I was able to find a calulation for Easter. It was similar to what you linked, but it also allows for Easter being in May (which happens). The final lines of code that calculates the month based on the value of days is;
// find the month
if (m_Day > 61) {
m_Day -= 61;
m_Month = 4; // May
} else if (m_Day > 31) {
m_Day -= 31;
m_Month = 3; // April
} else {
m_Month = 2; // March
}
Again, thanks for your help! |
|
Back to top |
|
 |
|