ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » IBM MQ Java / JMS » Need to calculate Easter Sunday using Calendar Class

Post new topic  Reply to topic
 Need to calculate Easter Sunday using Calendar Class « View previous topic :: View next topic » 
Author Message
72dolfan
PostPosted: Wed Mar 21, 2007 6:57 am    Post subject: Need to calculate Easter Sunday using Calendar Class Reply with quote

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
View user's profile Send private message
jefflowrey
PostPosted: Wed Mar 21, 2007 7:20 am    Post subject: Reply with quote

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
View user's profile Send private message
72dolfan
PostPosted: Wed Mar 21, 2007 7:32 am    Post subject: Reply with quote

Acolyte

Joined: 02 May 2006
Posts: 53

Doesn't Easter sometimes fall in March?
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Wed Mar 21, 2007 7:33 am    Post subject: Reply with quote

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
View user's profile Send private message
72dolfan
PostPosted: Wed Mar 21, 2007 7:38 am    Post subject: Reply with quote

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
View user's profile Send private message
jefflowrey
PostPosted: Wed Mar 21, 2007 7:59 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

It looks like the simplest algorithm is
http://en.wikipedia.org/wiki/Computus#Meeus_Julian_algorithm

If you choose to believe wikipedia.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
Michael Dag
PostPosted: Wed Mar 21, 2007 12:47 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website MSN Messenger
fjb_saper
PostPosted: Wed Mar 21, 2007 12:53 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
jefflowrey
PostPosted: Wed Mar 21, 2007 1:13 pm    Post subject: Reply with quote

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
View user's profile Send private message
Michael Dag
PostPosted: Wed Mar 21, 2007 1:22 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website MSN Messenger
jefflowrey
PostPosted: Wed Mar 21, 2007 1:48 pm    Post subject: Reply with quote

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
View user's profile Send private message
RogerLacroix
PostPosted: Thu Mar 22, 2007 8:12 am    Post subject: Re: Need to calculate Easter Sunday using Calendar Class Reply with quote

Jedi Knight

Joined: 15 May 2001
Posts: 3264
Location: London, ON Canada

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
_________________
Capitalware: Transforming tomorrow into today.
Connected to MQ!
Twitter
Back to top
View user's profile Send private message Visit poster's website
72dolfan
PostPosted: Fri Apr 06, 2007 7:39 am    Post subject: Re: Need to calculate Easter Sunday using Calendar Class Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » IBM MQ Java / JMS » Need to calculate Easter Sunday using Calendar Class
Jump to:  



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.