Calculating Julian Easter date

Hello,
I need to calculate the day of the of the Julian Easter
The Algorithm is e.g for year 2000:
1)Subtract 2: 2000-2=1998
2)MOD(1998, 19) = 3
3)Multiply *11: 3*11=33
4)MOD(33, 30) = 3
5)SUBTRACT FROM 44: 44-3=41
6)We start counting from March, so it is the 41 of March 2000 => 23 April 2000
7)Next Sunday of 23/04/2000 is 30/04/2000 which is the Easter day for 2000
SELECT
44-MOD(MOD((2000-2), 19)*11, 30)
FROM DUAL
Can you please assist me implementing step 6 in 9i ?
It must handle year e.g 2010 as well where the output till step 5 is 21 and we dont need to count over to the next month.
Thank you in advance

I tried it using the Meeus Julian algorithm
http://en.wikipedia.org/wiki/Computus
you could of course combine all the a b c d e stuff into one calculation but I left it alone for clarity
WITH years AS (    SELECT 1989 + LEVEL yr
                     FROM DUAL
               CONNECT BY LEVEL <= 30)
SELECT TO_CHAR (TO_DATE (day || ' ' || month || ' ' || yr, 'DD MM YYYY'),
                'DD MON YYYY')
          easter_day_julian,
       TO_CHAR (
          TO_DATE (day || ' ' || month || ' ' || yr, 'DD MM YYYY') + 13,
          'DD MON YYYY')
          easter_day_gregorian
  FROM (SELECT yr,
               a,
               b,
               c,
               d,
               e,
               FLOOR ( (d + e + 114) / 31) month,
               MOD (d + e + 114, 31) + 1 day
          FROM (SELECT yr,
                       a,
                       b,
                       c,
                       d,
                       MOD ( ( (2 * a) + (4 * b) - d + 34), 7) e
                  FROM (SELECT yr,
                               a,
                               b,
                               c,
                               MOD ( (19 * c + 15), 30) d
                          FROM (SELECT yr,
                                       MOD (yr, 4) a,
                                       MOD (yr, 7) b,
                                       MOD (yr, 19) c
                                  FROM years))))
EASTER_DAY_JULIAN     EASTER_DAY_GREGORIAN
02 APR 1990     15 APR 1990
25 MAR 1991     07 APR 1991
13 APR 1992     26 APR 1992
05 APR 1993     18 APR 1993
18 APR 1994     01 MAY 1994
10 APR 1995     23 APR 1995
01 APR 1996     14 APR 1996
14 APR 1997     27 APR 1997
06 APR 1998     19 APR 1998
29 MAR 1999     11 APR 1999
17 APR 2000     30 APR 2000
02 APR 2001     15 APR 2001
22 APR 2002     05 MAY 2002
14 APR 2003     27 APR 2003
29 MAR 2004     11 APR 2004
18 APR 2005     01 MAY 2005
10 APR 2006     23 APR 2006
26 MAR 2007     08 APR 2007
14 APR 2008     27 APR 2008
06 APR 2009     19 APR 2009
22 MAR 2010     04 APR 2010
11 APR 2011     24 APR 2011
02 APR 2012     15 APR 2012
22 APR 2013     05 MAY 2013
07 APR 2014     20 APR 2014
30 MAR 2015     12 APR 2015
18 APR 2016     01 MAY 2016
03 APR 2017     16 APR 2017
26 MAR 2018     08 APR 2018
15 APR 2019     28 APR 2019here it is combined
SELECT TO_CHAR (
          TO_DATE (
             (MOD (
                 (MOD ( (19 * (MOD (yr, 19)) + 15), 30))
                 + (MOD (
                       (  (2 * (MOD (yr, 4)))
                        + (4 * (MOD (yr, 7)))
                        - (MOD ( (19 * (MOD (yr, 19)) + 15), 30))
                        + 34),
                       7))
                 + 114,
                 31)
              + 1)
             || ' '
             || (FLOOR (
                    ( (MOD ( (19 * (MOD (yr, 19)) + 15), 30))
                     + (MOD (
                           (  (2 * (MOD (yr, 4)))
                            + (4 * (MOD (yr, 7)))
                            - (MOD ( (19 * (MOD (yr, 19)) + 15), 30))
                            + 34),
                           7))
                     + 114)
                    / 31))
             || ' '
             || yr,
             'DD MM YYYY'),
          'DD MON YYYY')
          easter_day_julianEdited by: pollywog on Nov 17, 2010 8:37 AM

Similar Messages

  • Interest Calculation on posting date and due date

    Hi
    I want vendor interest calculation on due date as well as posting date. Let me know how to get it. According to me only its possible on the basis of one date only.

    HEllo!
    In the report RFINTITAR, you use the interest indicator customizing:                                                                               
    IMG   > Prepare Item Interest Calculation   > Ref. Date                                                                               
    (table V_T056UX)   >  field Ref.                                                                               
    (FI Item Interest Calculation: Reference Date)                                                                               
    You have the possibility to define what You need to be considered as 
    incoming payment due date, choosing between:                                                                               
    1 Value Date (or Baseline Date for Net Payment)                      
    2 Document Date                                                      
    3 Posting Date                                                       
    4 Payment Baseline Date                                                                               
    As you can use one interest indicator per customer/vendor you can use only of the dates is used. But, in this
    program you can use the BADI FI_INT_CUS01. Please, check if you can meet your business requirements using the methods
    of the BADI.
    REgards,
    REnan

  • Interest calculation on due date and not on invoice

    Hello,
    Pls can some one let me how to start interest calculation on due date and not invoice date.
    In the interest calculation, T code FINT, the system calculates interest from invoice date till clearing date and not from due date till clearing date.
    BR,
    Zulfikar

    Hello,
    We have selected the Always calculate interest from net due date check box. but now when i run FINT transaction for a customer it is calculation interest from invoice date and not on due date. the item is already cleared.
    The scenarion is
    the net due date of the docuemnt is 30.07.2008 so the interest calculation should stard from 31.07.2008 till clearing date. but the interest calcualtion is starting from 01..07.2008 which is the invocie date.
    BR,
    Zulfikar

  • Calculation based on date key figures in BEx

    Hi Friends,
    Hi Friends,
    I need to creat report for sales order data, which involved the calculation based on dates.
    In my cune iam having the data at the granual level with the dates as key figures. the calculation that i need to do is VTW = Actual PGI date - Customer want date.
    1) whn i run the report at the granual level my VTW is working correctly. No issues.
    2) when i run the report at higher levels the date fields are updated with X, as the system is unable to aggrigate the dates. The dates are at the material level in  a sales order. I need to show the VTW at the sales order level (each one of the two dates are same for all the materials). So, when i run the report with out mataril at the sales order level...i wanto sea the bothe date fields in a single line and also the VTW calculated as the different between throse two dates.
    3) Once we get the VTW correctly at the sales orde level. if i drill down the report for material, i want to sea both the dates in every record againest the matarial, but the VTW only aginest the first record...that is againest the sales order. I dont waht the VTW value repeated/duplicated for all the records againest the sales order,as VTW makes sence only at the Sales Order level.
    Please suggest me hwo i can achive the resulsts by meeting both Point 2 and 3.
    Thanks for ur help...in advance.
    Thanks,
    Renu

    Hi..
    I have the data from the extractore and in the cube as below.
    SALES ORDER    ITEM                MATERIAL            DATE1                         DATE2
    101                        Item1               Mat1              01/01/2010                15/01/2010
    101                        Item2               Mat2              01/01/2010                15/01/2010
    101                       Item3                Mat3             01/01/2010                15/01/2010
    I need the reports as below...
    Report1:
    SALES ORDER        DATE1                         DATE2                  VTW (DATE2 - DATE1)
    101                        01/01/2010                15/01/2010                14
    currently iam getting this Report1 output as below...
    SALES ORDER        DATE1                         DATE2                  VTW (DATE2 - DATE1)
    101                             X                                   X                           42
    Report2: Out put required as below
    SALES ORDER     ITEM                MATERIAL            DATE1                         DATE2      VTW (DATE2 - DATE1)
    101                        Item1               Mat1              01/01/2010                15/01/2010              14
    101                        Item2               Mat2              01/01/2010                15/01/2010
    101                   I     tem3                Mat3             01/01/2010                15/01/2010
    currently iam getting this Report2 output as below...
    SALES ORDER     ITEM                MATERIAL            DATE1                         DATE2      VTW (DATE2 - DATE1)
    101                        Item1               Mat1              01/01/2010                15/01/2010              14
    101                        Item2               Mat2              01/01/2010                15/01/2010               14
    101                   I     tem3                Mat3             01/01/2010                15/01/2010               14
    As VTW is need to be measued at the sales order level and we always have the DATE1 & DATE2 as same for all the itesm, it should be shon as only 14 in the first record. It mean once iget the required output from Report one in a single line with VTW as 14, it should not repeat with every line , when i dril down the report for Items or materials.
    Even if i can generate oly report2 as required in a single sheet ...that will be enough.
    Plas kindly provide some solution as how we can achieve this,
    Thanks,
    Renu

  • Post Calculation Computation for Date/Timestamps

    Hello,
    I would like to know how to apply Post Calculation Computation for Dates/Timestamps?
    I had trouble trying to add this to the Post Calculation Computation area:
    TO_CHAR(:P1_TARGETDATE, :DEFAULT_DATE_TIME_MASK);
    or should it be something more like:
    SELECT
    TO_CHAR(:P1_TARGETDATE, :DEFAULT_DATE_TIME_MASK) FROM DUAL;
    What would be the correct code to allow me to format a date/Timestamp where a Application Variable of DEFAULT_DATE_TIME_MASK could be used as well. (I dont want to use the existing Format Mask.)

    Just a hunch, but you might be having a problem because of the double quotes. Oracle likes single quotes. You also might want to forgo the quotes entirely.
    As for an invalid number, is it possible that one of the values that you are adding might be NULL. You can't add NULL to a number or you get an error. There are two solutions to that. One would be to do an NVL around each number you are adding (changing it to zero if the value is NULL). The second option (and easier option) is to use the SUM function. Mathematical functions like SUM and AVG ignore those values that are NULL.

  • How to perform calculations using column data in BI Publisher

    Hello guys
    I am very new to BIP, and recently I am learning to create new templates using XML files..
    I am trying to create a report that has Account Amount, Amount Net Amount, PM_Amount and a New field say "X"
    For Account Amount it is what it is, but for Net Amount it is "Account Amount/40%", for PM_Amount it is "Net Amount x (Account Amount/30)" and for field X it is "(Net Amount + PM_Amount)/column A" where column A is another data field in the XML file but it should not be included in the template report..
    Could anyone help me with how to perform such kind of calculations in BIP Template builder? In OBIEE, it is very easy that I can just use column formula, but in BIP I still haven't figure out the way yet..
    PLease advice
    Thanks

    Thanks for the reply..
    I looked at the link you provided already, what I wanna know is how to exactly apply the expression in my calculation. In other words, I know that Column C = "Column A div Column B", but in BIP form property, how do I actually substitue "column A" with the actual column..
    I wish I could post the XML, but it is huge, it contains 6 data sets and more than 100 columns. I only need 15 columns on my template.
    On the form property of each measures, in the "advance tab", I see codes like <?accountamount?>. Now I wanna have a new column said "PM_Amt" which should be "(accountamount div %40) x column B". So I just randomly select another column said "payment". I rename it to "PM_AMT" and on its "advanced tab" it is still <?payment?>. So right there, if I wanna replace that code with a new one that does "(accountamount div %40) x column B" calculation, how would I do it? What would be the syntax including how to propertly refer to the right column field as part of the expression?
    And do I have to always use xdofx between <>? how would I know?
    Please advice if you understood what I am trying to say
    Much thanks
    Edited by: user7276913 on Sep 14, 2009 11:24 PM

  • Custom calculation script (roll date forward)

    I'm trying to add 6 days to a date that is in a user defined form field   called PeriodBegin
    The new calculated date should b e:   PeriodBegin + 6 days and should display in a new form field called PeriodEnd
    I've tried using some code that I've found on the web but can't get it to work.    Help!

    Hi pauker11,
    Read this tutorial from the acrobatusers.com Learning Center-
    http://acrobatusers.com/tutorials/2006/date_time_part2/
    and download the sample file DatesExample1 which includes a sample for adding a number of days to a date from another field.
    Hope this helps,
    Dimitri
    WindJack Solutions
    www.pdfscripting.com
    www.windjack.com

  • Calculating and Displaying Dates in Javascript

    Hello,
    I'm working on a flowchart form for my work, and am having issues getting a date to a) add correctly and b) display only certain portions of the date.
    I have four fields:
    CurrentDate - Displays the Current Date in MM/DD/YYYY format
    DropDownList1 - Contains a list of projects end users can choose from
    TextField1 - Displays text that tells the end user how many days the proejct will take
    DateField1 - Should add the CurrentDate + the Number of days the project will take and return a new date in the same MM/DD/YYYY format
    *Disclaimer* - I am not very experienced with scripting, and chose to go with JavaScript as I do have some previous past experience.
    Here is what I have for my code right now:
    if (DropDownList1.rawValue == 1){
    TextField1.rawValue = "2 Days";
    var AddDate = (Date.valueOf(CurrentDate) + (2*1000*60*60*24));
    DateField1.formattedValue = Date(AddDate);
    else if (DropDownList1.rawValue == 2){
    TextField1.rawValue = "1 Day";
    else if (DropDownList1.rawValue == 3){
    TextField1.rawValue = "2 Days";
    else if (DropDownList1.rawValue == 4){
    TextField1.rawValue = "2 Days";
    else if (DropDownList1.rawValue == 5){
    TextField1.rawValue = "4 Days";
    else if (DropDownList1.rawValue == 6){
    TextField1.rawValue = "5 Days";
    else if (DropDownList1.rawValue == 7){
    TextField1.rawValue = "4 Day";
    The end result is that the TextField1 displays the correct day, but the DateField1 displays a long string of the exact time and date of... well, the time - so no adding takes place. What I need is for the date to be displayed as MM/DD/YYYY. What am I doing wrong? I've only added the calculation to the first "if" statement, and will continue on to the rest once it is functioning.

    The following code will work in a LiveCycle Designer button using the "JavaScript" language option:
    var oNow = new Date(); // get date time object
    console.show(); // oepn and clear the JavaScript console
    console.clear();
    console.println("oNow = " + oNow);
    console.println("oNow.getFullYear() = " + oNow.getFullYear());
    console.println("oNow.getMonth() = " + oNow.getMonth());
    console.println("oNow.getDate() = " + oNow.getDate());
    console.println("oNow.getDay() = " + oNow.getDay());
    console.println("oNow.getHours() = " + oNow.getHours());
    console.println("oNow.getMinutes() = " + oNow.getMinutes());
    console.println("oNow.getSeconds() = " + oNow.getSeconds());
    console.println("oNow.getTimezoneOffset() = " + oNow.getTimezoneOffset());
    The following script uses FormCalc and can be used with a button for testing:
    var oDate = Date() // get today's date
    var Year = Num2Date(oDate, "YYYY") // get year four digits
    var Month = Num2Date(oDate, "MM") // get month 2 digits with leading zero
    var Date = Num2Date(oDate, "D") // get date without leading zero
    xfa.host.messageBox( Concat("oDate: ", oDate, " Year: ", Year, " Month: ", Month, " Date: ", Date) )
    var MyDate = "Feb 23, 2008" // a string data
    var Year = Num2Date( Date2Num(MyDate, "MMM D, YYYY"), "YY" ) // 2 digit year
    var Month = Num2Date( Date2Num(MyDate, "MMM D, YYYY"), "M" ) // month without leading zero
    var Date = Num2Date( Date2Num(MyDate, "MMM D, YYYY"), "DD" ) // day with leading zero
    xfa.host.messageBox( Concat("MyDate: ", MyDate, " Year: ", Year, " Month: ", Month, " Date: ", Date) )

  • Calculating Life to date values

    Hi there,
    the users are looking to get life to data values for service order. We can do this in the query (on the front end) but the performance takes a big hit due to the volume of records that are retrieved. So we are looking to build this calculation on the backend. Has anyone here done something similar and could share their experience on this?  To repeat, the users would like to see the life-to-date value and this will contain any amounts that have been posted to this object. I was thinking about using a standard dso for this solution and use the amounts related cubes as source for this dso. The key figures (or data fields) in the dso would be incremented from the delta loads from the underlying cubes.
    Thanks for sharing your thoughts or experience handling this issue.

    If I am getting you correctly, you are getting the following output(sample) where you are getting few additional orders for which cost$ is zero but we have &cost(life to date value) like 10002563 .
    Order#          Fiscal period               $costs         $costs (life-to-date)
    10001111           001.2012                 5,000             50,000
    10001111           002.2012                 5,000             50,000
    10001112           001.2012                 6,000             30,000
    10001112           002.2012                 7,000             30,000
    10001112           003.2012                 7,000             30,000
    10001113           003.2012                 5,000             10,000
    10002563           001.2012                  0                   5000
    If this is the issue then you can put a condition on cost& Key figure to be not equal to zero.It would solve the issue.
    I would request you to provide us the sample output with both the correct and incorrect orders so that we can further understand the issue.

  • Interest calculation on due date

    Hi
    I want interest calculation from duedate (which is 30 days from invoice date). In one of the step of configuration, i defined Interest calculation indicator as VK. In that there is a option which says from where interest needs to be calculated. There are options:
    Value Date (or Baseline Date for Net Payment)
    Document Date
    Posting Date
    Payment Baseline Date
    There is nothing as due date. Please let me know how to do this.
    Is Value date the due date ?

    HI Deepak,
    You do not need to select that interest should be calculated on overdue items which means from due date,,,this is standard settings...
    Regards,
    Chintan Joshi

  • SSAS data source calculating from two data source

    Hi There,
    I have SSAS cube and use SSRS 2008R2. Basically I have cube A for current month income statement, cube B from previous month, they have shared the same dimensions. I want to create  report to show
                      current month  previous Month            Calculation
       Account               Amount A         Amount B            Amount A - Amount
    B
    Revenue                 Amount A         Amount B            Amount B
       Expense              ,,,,,,
    Net Income
    Any advice?
    Thanks
    Don

    Hi Dz0001,
    According to your description, you want to combine the data from two cube into one tablix. Right?
    In this scenario, since your two cube share same dimensions, we can use lookup() function to retrieve the income from another dataset based on the data field for dimension rows.
    For example, let's say you have DataSet1 retrieves data from cube A with data fields
    Account and Income, DataSet2 retrieves data from cube B with data fields
    Account and PreIncome. When rendering the data field from DataSet1 in a table, you can use the expression below in detail row.
    =Lookup(Fields!Account.Value,Fields!Account.Value,Fields!PreIncome.Value,"DataSet2")
    Reference:
    Lookup Function (Report Builder and SSRS)
    If you have any question, please feel free to ask.
    Best Regards,
    Simon Hou
    TechNet Community Support

  • Calculation of due date based on Business Days for FICA documents

    Hi All,
    I am working on project where SD - FICA integration is in picture. We post some charges through SD and FICA document gets posted on relevant Contract Account.
    Normally we create Sales Order using transaction VA01 and then we do Billing for this Sales Order through VF01. After billng is done, FICA document automatically gets generated.
    We have following requirement to be fulfilled.
    For the SD bills posted as above, I want to calculate due date of these bills based on Business Days for FICA document generated (SAP Standard calculate due date based on Calander days). We can use factory calander for calculating business days in relevant function module.
    I have checked in the system and it seems that event 1330 ( FM - ISU_DUE_DATE_DETERMINE) is not working in this scenario. Is there any other FM which I can use?
    Can anyone help me on this?
    Regards,
    Pradeep

    Hello Praeva ,
    The event 1330 has a sample FM FKK_SAMPLE_1330. It doesnt even have a Standard Function Module.
    You need to create a Installation-Specific FM and put your code to determine the Due Date based on the logic.
    Rgds
    Ram Kumar.

  • Calculation of basic dates and schedule dates

    I update material master from routing with CA97 to material master
    work scheduling data with base quantity 1000
    When MRP running, planned order for 54000 PCS is schedule with work scheduling data.
    when i schedule planned order (change)
    the calculation basic date & schedule date differs for 19 days
    cause basic start shift
    why is this happend?
    is this cause by rounding when transforming minute from routing to days in material master?
    is this because i used shift sequence and scheduling with breaks?
    some strage case again is
    for base qty 1000 processing time is 0.97
    for base qty 10000 processing time is 6.93
    is there any solution for this case?
    please help.
    Best regards,
    Freddy Ha

    i forgot i used overlapping
    sorry

  • Calculation of basic date and schedule date

    I update material master from routing with CA97 to material master
    work scheduling data with base quantity 1000
    When MRP running, planned order for 54000 PCS is schedule with work scheduling data.
    when i schedule planned order (change)
    the calculation basic date & schedule date differs for 19 days
    cause basic start shift
    why is this happend?
    is this cause by rounding when transforming minute from routing to days in material master?
    is this because i used shift sequence and scheduling with breaks?
    some strage case again is
    for base qty 1000 processing time is 0.97
    for base qty 10000 processing time is 6.93
    is there any solution for this case?
    please help.
    Best regards,
    Freddy Ha
    Edited by: Freddy Halim on Jan 28, 2010 7:40 AM

    Hi,
    Yes. The schedule date is generated considering your factory calender also in addition to the routing data. For eg.. Suppose if Saturday and sunday are holidays, the schedule date will be extended to 2 days.
    Pl. check the  unit in your routing for the second query.
    Pl. refer the link
    http://help.sap.com/saphelp_47x200/helpdata/en/b1/c042b7439a11d189410000e829fbbd/frameset.htm
    Madhava

  • Calculation of start date with backward scheduling

    Dear all,
    I am facing an issue related to backward scheduling. I have requirement in which whenever backward scheduling is used, system should calculate from last activity to first for calculation of schedules which is fine. But when running scheduling i am giving finish date as input and system is always using start date as current date and not calculation last date from last. For example if i input finish date as 15 feb 2015, and there is only one activity of 15 days, system should count start date from 1 feb 2015. Please help me how i can achieve this, currently its always putting start date as current date.
    My current settings are--
    Project definition-  WBS Scheduling profile-  Backward scheduling
                                  scheduling scenario-  Free scheduling
    Network-      Planning type- basic dates
                        Scheduling type- Backward
    Please help.
    Thanks

    Dear all, this issue is resloved. Reason was that by default i am using forward scheduling for all project but in case of backward scheduling, user change schedule type at project definition and network. I was removing start date and putting finish date and running scheduling. Missing step from my side was i need to first copy date from top to down than run scheduling again.
    Thanks.

Maybe you are looking for