Date calculations

I'm figuring dates for a timesheet in two weeks.  The person making the timesheet from the pay period end date.  When they click on the next box, where they enter their name, etc, I want to fill automatically the dates next to each day in the table for the next 14 days.  I decided to subtract one from the pay period end date, to be inserted in the box next to Friday (day 6, 2nd week), and so on until what I am on the first day of the pay period, which would equal the (pay period ending early - 13).  Pretty easy to explain, but I have no idea how the code should look like, and if I calculate, or click on, or what.

I saw the functions Num2Date and Date2Num, but I don't know where I should do these Calc and how to set the field that is the answer, so I can then that display in the table.  I tried to create calculations that reference a field I set read-only for each date.  Except that I get an error saying Wk2Fri is not good.  What I have to define this area somewhere in the code, and if I do, where and how?

Y at - it a book that explains some of this stuff out there.  I never get tired of asking and look like an idiot.

If someone wants to see the form, leave an email address and I'll send it to you.  Files attach routine does not work (at least it wasn't the last time I tried it.)  I'll try it at aattach now.  Let me know if you can not see.

Thanks for your help.

Here's my cup to your form. It is not quite complete. It takes the date in the date picker control and uses the functions of date2num and num2date FormCalc to fill the table with the dates to before it two week period end date.

The attached .png highlights the result to choose an end date that is not a Saturday.

Steve

Tags: Adobe LiveCycle

Similar Questions

  • Problems with date calculation

    I have a java (and much more far vb) background and it seems that I'm really dependent functions for date calculations.  I'm trying to do a few things, but have not been able to accomplish them.

    I do not have

    Calendar.add()
    

    I briefly contemplated an add function by converting into long then do the calculation and returns a new calendar object, but the problems with this approach comes flourishes as soon as I started.  Just trying to find out if a date was yesterday was me banging my head against the wall.

    Any help please?

    I wrote this, but I don't know if there is a simpler method, go to this issue the wrong way, etc.

    public static boolean isYesterday(Calendar c) {
        Calendar today = Calendar.getInstance();
        int newDay = today.get(Calendar.DAY_OF_MONTH);
        if (newDay == 1) { //get last day of previous month
            int newMonth = today.get(Calendar.MONTH);
            int newYear = today.get(Calendar.YEAR);
            /* If jan 1, get dec of last year */
            if (newMonth == 0) { //Java Calendar.MONTH is zero-based
                newMonth = 11;
                newYear -= 1;
            today.set(Calendar.YEAR, newYear);
            }
            today.set(Calendar.MONTH, newMonth);
            newDay = DateTimeUtilities.getNumberOfDaysInMonth(newMonth, newYear);
        } else {
            newDay -= 1;
        }
        today.set(Calendar.DAY_OF_MONTH, newDay);
        return DateTimeUtilities.isSameDate(today.getTime().getTime(), c.getTime().getTime());
    }
    

    'convert to tz to the device.

    I recommend that stick you with using UTC for everything.  If you want to display to the user, then a DateField will convert the hour UTC to local time.  SImpleDateFormat.formatLocal will also print you long time UTC to local time.  So I recommend that you do not have to convert once at the local level.

    Remember that System.currentTimeMillis () is time not UTC/GMT.

    Of course, that's a good advice or not depends on your app.

    I'm not aware of any third-party code that helps, I reinvented wheels square to all my treatment to date.  But I never really looked at.

    About your code, assuming that c calendar uses the local time zone, so I think that the code works.

  • How do I load the data calculated in HFM

    Hi gurus

    1. how to load the data calculated in HFM?

    I extracted the calculated data and when I tried to load the data calculated in HFM is partially responsible, showing the errors you can not load data for parent members of the account, Custom personalized 1 4...
    Then I ran the consolidation to get the values of the parent company.
    Is there an alternative way to load the data calculated in HFM?

    Concerning
    Hubin

    Hi Hubin,

    Calculated data cannot be loaded in HFM manually, these accounts with calculated field data should be generated through the logic of the computation.

    And parent members also don't take the data they are parents for the sum of some basic level accounts.

    So just load the data for basic level accounts and make sure they are consolidated accounts of field, that there was no error and calculated accounts data automatically generates through the logic written in the Rules file.

    And after loading data just run the consolidation and sink also rules file in both cases to the work of the logic of the computation.

    Kind regards
    Srikanth

  • How can I save machine vision data calculated?

    Hello everyone,

    I developed a machine vision vbai file to detect the edge of a droplet and calculate the radius of the drop. However, I would like to save the data of droplets of RADIUS in a file so that I can follow the distributions of droplets at the time RADIUS and see it in excel for example.

    However, in the range of functions of industrial vision I see not all save data option and so I transferred the code in a labview VI hoping to get more options. When I opened this VI, I can't really find out where my calculated data are, and I can't also manage store data anyway.

    I'll post the Labview VI and VBAI files and hope someone can tell me how I can save the droplet radius size because I'm kinda a noob in programming Labview.

    Thanks in advance Schoonen Jan-Willem

    Hi René,.

    It worked, thank you very much!

  • Later Date calculation

    I have to add 60 days to a date and then roll forward to the first day of the following month.  Date format is dd/mm/yyyy.  Original date field is "Hire Date".

    Did you emissions?

    There was a lot of similar questions on calculation of future dates. You searched these items?

    First of all, it must convert the date string in the JavaScript date object. Add then 60 days for the date object. Set the 1st of the month. Finally, add 1 month for the month of the date object and format the output for display.

    Script possible custom logic for the anniversary date is:

    get the rental date string;

    var cHireDate = this.getField("Hire_Date").value;

    Converts a date in the date object string;

    Kai var = util.scand ("mm/dd/yyyy", cHireDate);

    Add 60 days;

    oDate.setDate (oDate.getDate () + 60);

    the value date oject first of the month.

    oDate.setDate (1);

    Add a month;

    oDate.setMonth (oDate.getMonth () + 1);

    format the result;

    Event.Value = util.printd ("mm/dd/yyyyy', letter);

    Note the format of the date field is 'None '.

  • How is due date calculated in Oracle accounts payable

    Hello

    On what basis is calculated to the due date of an invoice.

    Say that payment terms are 10 days.

    That only takes into account the days or weekends and holidays as well.

    The due date is calculated on the basis of the date of invoice or the date of receipt?

    Kind regards

    Amanda

    Hello

    Please see the following content.

    Of the APLIST, the calculated due Date is correct. The invoice was created the

    May 17, 2010 and received was created on May 20, 2010. Later, when the Bill was

    validated, the system has recalculated the payment as plans ' recalculate payment

    Schedules has been activated.  The system has generated the due date as June 19, 2010, for a term of

    -Net30.

    Here's how the calculation of the due date:

    ---------------------------------------------------------------

    --> In general, Due date get calculated based on the most recent available departure dates. Date the most recent available beginning is derived according to the following formula.

    Greatest (Goods_Received_Date + Receipt_Acceptance_Days, Invoice_Date, Terms_Date).

    -> In the algorithm above, Goods_Received_Date is a date which is filled on the invoice based on terms_date_basis to the provider/site level.

    a. If terms_date_basis = "Goods received" so Goods_Received_Date get filled.

    (b) if terms_date_basis = "Invoice received" or anything else then, Goods_Received_Date is null.

    -> Receipt_Acceptance_Days is the number of days defined for "Receiving acceptance days" the tab invoice Options in Payables.

    -> So, the due date is the most recent DATE of INVOICE, DATE CONDITIONS, GOODS RECEIVED ACCEPTANCE DATE + RECEPTION DAYS.

    -> In the case of a corresponding invoice, the system takes into account the date of the Transaction of reception of the

    Reception for the calculation of a recent start date, because sometimes the DATE OF RECEIPT of GOODS is zero.  This feature is available from the beginning only 11i. See bug #1655225 for more details.

    a.So first system determines the recent date of GOODS RECEIVED DATE + RECEPTION ACCEPTANCE DAYS and TRANSACTION DATE of RECEIPT.

    b.After that checks most recent date from the defined formula again.

    -----------------------------------------------------------------------------

    If the customer does not want the system to use "Date of receipt" and then disable "recalculate the payment plans.

    If the customer wishes a new calculation, the system considers "Date of receipt" to a corresponding invoice.

    Concerning
    Gavin.

  • -DATE CALCULATION question - generate & calculate date

    Hi all

    I need a suggestion concerning the calculation of the date in essbase.

    the case is:
    -first of all, I need to generate date for each month, depending on the size of the period and the year. and uses the last date of the month in the date.
    IE: If the year = FY11, period = Feb, then it generates members date1 = 20110228 (date1 member is considering membership with the date type)

    - then I need to calculate the difference in days between each month.
    IE: day_diff = date1 (20110228) - date1 of the month previous (20110131)


    anyone has idea or an idea that will help you?

    Thank you
    Feri

    You can use CDFs for the same thing, to first take a look at:
    http://download.Oracle.com/docs/CD/E12825_01/EPM.111/esb_dbag/frameset.htm?dcaudfs.htm

    Strings and Date for Essbase on SampleCode.Oracle.com functions:
    https://www.samplecode.oracle.com/tracker/tracking/linkid/prpl1004/action/ExecuteQuery?sfLoginToken=6D547D1FA88748A089A3C63EC282807B&sfProj=codesamples&isLoggedIn=true&sfLoginToken=0D11D7FCD6438541703B23FFCF6B2AFA&sfProj=codesamples&jSessionId=93DB7560AE2FF2C5F9D9AD7DCA34D50B&isLoggedIn=false&query=essbase1&dapCheckedPassed=false

    See you soon... !!

  • Case statement using column Date calculated in responses

    Hello

    I have a calculated column is column # 4, in the responses with the following code
    "CASE WHEN 'Handmade'." Date of the project"is set to NULL THEN TIMESTAMP ' 1900-01-01 12:00" ELSE "Handmade" "." " The project 'END' date, so now I filled all Null values in the field to date with ' 1900 - 01 - 01 12:00 '.

    I have another column with the following syntax, which only gives me an error, but the 'Undefined' values for the timestamp above is not met.
    "BOX WHEN" @4 ' = ' 1900 - 01 - 01 12:00 ' THEN 'Undefined' OTHERWISE "Main Dim". " "Project name" END ".

    Please let me know how to fix this. Thank you for your time and your help.

    Hello

    Try this

    case when cast (CASE WHEN Time. "Day Date" "IS NULL THEN TIMESTAMP ' 1900-01-01 12:00 ' time else. '" (Date of the day' END as char) = TIMESTAMP ' 1900 - 01 - 01 12:00 ' then 'undefined' other end Products.Product

    Replace your respective columns

    Thank you
    Saichand.v

  • LiveCycle incorrect Date calculation?

    I have a couple of areas of a form that copy the following code:

    DateTimeField2.rawValue = Num2Date (Date2Num (xfa.event.newText, ' DD/MM/YYYY "" ") + 30," MM/DD/YYYY");

    Essentially allows you to choose a date that determines a later date of 30 days from the date you have chosen. Sound simple enough however the calculated date is always disabled? So if I take the 2010-07-01 he picks on 31/07/2010, if I choose on 01/02/2010, he chooses 03/03/2010.

    I'm totally stumped as to why this happens, and I am against a wall to make it work. Does anyone have any suggestions?

    Date2Num function converts the date in number. It is then add 30 to the number and then by converting the number back to this day.

    During this process, it does not intend to include the selected date. So in your case, if you want to have the exact 30 days including the selected date, then try adding only 29 instead of 30.

    I hope this helps...

    Thank you

    Srini

  • How to store field data calculated in a table when a user disconnects?

    Hello

    I have a report with the following SQL statement.
    Past_Due and Task_Count are calculated fields.
    How can I store their data in a table when a user disconnects?

    Select
    p.ID,
    p.Name,
    p.Description,
    p.assigned_to,
    p.start_date,
    p.Finish_Date,
    p.target_date,
    CASE
    WHEN P.target_date < SYSDATE AND P.finish_date IS NULL THEN round (SYSDATE - P.target_date)
    WHEN P.target_date < P.finish_date THEN round (P.finish_date - P.target_date)
    0 OTHERWISE
    END Past_Due,
    p.Status,
    p.updated_by,
    p.updated_on,
    p.Note,
    Count (t.ID) task_count
    pm_project p, pm_task t
    where
    p.ID = t.project_id (+)
    P.id group,
    p.Name,
    p.Description,
    p.assigned_to,
    p.start_date,
    p.Finish_Date,
    p.target_date,
    CASE
    WHEN P.target_date < SYSDATE AND P.finish_date IS NULL THEN round (SYSDATE - P.target_date)
    WHEN P.target_date < P.finish_date THEN round (P.finish_date - P.target_date)
    0 OTHERWISE
    END,
    p.Status,
    p.updated_by,
    p.updated_on,
    p.Note

    -----
    H5. FYI, I am very new to SQL, PL/SQL, and APEX. Would appreciate much more explanation and full path (for example. Shared components > change the security attributes > VPD)

    Hello

    Past_Due and Task_Count are calculated fields and are therefore useless.
    You must not store redundant data (in general).
    Your past_due also uses a reference to sysdate, so the value is today different from tomorrow. You expect the database to change the value from one day to the next?
    So keep the data where it is and display calculated to your users using your query fields (oher options are available, but you already have the request I will not go in the).

    Greetings,
    Roel
    http://roelhartman.blogspot.com/
    You can reward this response in marking it as useful or Correct ;-)

  • Make a date calculation within nested in BI Publiser ifs

    Hello.

    Asked me to convert all of our Crystal reports that are used for BI Publisher, in preparation for moving to 9.2 PeopleSoft. My problem is that my expertise lies more with Crystal BI Publisher.

    My problem is that I do a conditional calculation to get the number of days, that someone was on a claim. Crystal the formula looks like this:

    in the case of CONTRARY ISNULL ({COL_CLAIMS_OUTSTANDING1. COL_CLM_1ST_DY_UBL}) then

    If ISNULL ({COL_CLAIMS_OUTSTANDING1. COL_CLM_COMPLETE}) then

    DateDiff ("d", {COL_CLAIMS_OUTSTANDING1. (COL_CLM_1ST_DY_UBL}, today)

    on the other

    DateDiff ("d", {COL_CLAIMS_OUTSTANDING1. COL_CLM_1ST_DY_UBL}, {COL_CLAIMS_OUTSTANDING1. COL_CLM_COMPLETE}

    I have some code obtained from other parts of the forum and has managed to ride with singleton instructions that work. For example:

    <? xdofx:round ((to_number (to_char (SYSDATE, 'JSSSSS')) - to_number (to_char (to_date (A.FIRST_DAY_UNABLE, 'YYYY-MM-DD'), 'JSSSSS'))) div 100000)? >


    But when I try to make the nested conditional so I don't get no return what so ever and I have no idea what I'm missing (even though I'm pretty sure that it will cause slap me my forehead and say "DOH"):

    <? xdofx:A.FIRST_DAY_UNABLE! = "then

    If A.CLAIM_COMPLETE = "then

    Round ((TO_NUMBER (to_char (sysdate, 'JSSSSS')) - to_number (to_char (to_date (A.FIRST_DAY_UNABLE, 'YYYY-MM-DD'), 'JSSSSS'))) div 100000)

    on the other

    Round ((TO_NUMBER (to_char (A.CLAIM_COMPLETE, 'JSSSSS')) - to_number (to_char (to_date (A.FIRST_DAY_UNABLE, 'YYYY-MM-DD'), 'JSSSSS'))) div 100000)

    end if? >

    Thank you... I was able to understand it and fixed by the following:

    If A.CLAIM_COMPLETE = "then

    Round ((TO_NUMBER (to_char (sysdate, 'JSSSSS')) - to_number (to_char (to_date (A.FIRST_DAY_UNABLE, 'YYYY-MM-DD'), 'JSSSSS'))) div 100000)

    on the other

    Round ((TO_NUMBER (to_char (A.CLAIM_COMPLETE, 'JSSSSS')) - to_number (to_char (to_date (A.FIRST_DAY_UNABLE, 'YYYY-MM-DD'), 'JSSSSS'))) div 100000)

    end if? >

  • Date calculation

    I have two fields with custom formatting (script typo for numbers only)

    As a validation to validate the entry as a date (DDMMYYYY) (client wants a different error message)

    Now I want to check if the date of the 1st is older, then day 2

    But I do not operate.

    I get the following error: "TypeError: vDateInput2 is null.

    I tried as follows:

    event.rc = true;
    
    
    if (event.value) {
              if (util.scand("ddmmyyyy", event.value)==null) {
                        app.alert("Wrong date");
                        event.rc = false;
                        event.target.setFocus();
              }
              else{
                        var vDate1 = event.value;
                        var vDate2 = this.getField("DateField1").value;
    
    
                        var vDateInput1 = util.scand("ddmmyyyy",vDate1);
                        var vDateInput2 = util.scand("ddmmyyyy",vDate2);
    
    
                        var diff = vDateInput2.getTime() - vDateInput1.getTime();
    
    
                        if(diff < 0){
                                  app.alert("Wrong date. Date 1 must be older than Date 2");
                                  event.rc = false;
                                  event.target.setFocus();
                        }
              }
    }
    
    

    Yes, it was him... but there is another question. See my PM.

  • Julian Easter date calculation

    Hello
    I need calculate the day of the of the Julian Easter
    The algorithm is for example for the 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 44:44 - 3 = 41
    (6) we start from March, is the 41 of March 2000 = > 23 April 2000
    (7) next Sunday from 23/04/2000 is 30/04/2000, which is the day of Easter for 2000

    SELECT
    44 MOD (MOD ((2000-2), 19) * 11: 30)
    OF THE DOUBLE
    ;

    Can you please help me to implement step 6 in 9i?
    It must manage the year e.g. 2010 as well where the output until step 5 is 21 and we don't need to rely on next month.

    Thanks in advance

    I tried using Meeus Julian algorithm
    http://en.Wikipedia.org/wiki/computus
    you could combine all the a b c d, e stuff in a calculation, but I left 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 2019
    

    Here 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_julian
    

    Published by: pollywog on November 17, 2010 08:37

  • Help with date calculation

    Need help to calculate a future date.  Right now I have it where he Calc. 25 days in the future.  But need 25 working days in the future.

    Form1. Page1.Button1::click - (JavaScript, client)

    var oNow = new Date();
    Add 25 days and subject to the new date
    oNow = new Date (oNow.getFullYear (), oNow.getMonth (), (oNow.getDate () + 25))
    view the new date information
    sMsg = "in 25 days, it will be" + util.printd ("mm/dd/yyyy", oNow);
    sMsg += "\n" + "the day of the week will be" + util.printd ("dddd", oNow);
    App.Alert (sMsg, 3, 0)

    Hello

    I have not tried this, but it should be close:

    var oNow = new Date();
    var oDay = util.printd("dddd", oNow);
    // add 25 working days and make new date object
    if (oNow == "Saturday")
    {
         oNow = new Date(oNow.getFullYear(), oNow.getMonth(), (oNow.getDate() + 35 + 2));
    }
    else if (oNow == "Sunday")
    {
         oNow = new Date(oNow.getFullYear(), oNow.getMonth(), (oNow.getDate() + 35 + 1));
    }
    else
    {
         oNow = new Date(oNow.getFullYear(), oNow.getMonth(), (oNow.getDate() + 35));
    }
    // dispaly new date information
    sMsg = "In 25 working days it will be " + util.printd("mm/dd/yyyy", oNow);
    sMsg += "\n" + "The day of the week will be " + util.printd("dddd", oNow);
    app.alert(sMsg, 3, 0);
    

    The 35 is seven days for each of the 5-day work weeks. The + 2 and + 1 grow a weekend in the next business day.

    Hope that works,

    Niall

    Ensure the dynamics

  • The quarters of Format for Date calculation

    a date column with the guidance of 10:33:02.Please format 2005-03-18 have me how should I calculate the quarters and year of this format.

    This forum uses the WITH statement as a tip for a substitution table without having to put in place a real table, especially when the CREATE TABLE of the affected table statement was not displayed together with some INSERT statements.
    These substitution tables are almost always accumulate by running
    Select... of double
    Union
    Select... of double

    In your case, as I have already indicated, in your initial statement, you must first convert tc_vts to a date like this
    Select to_char (to_date (tc_vts, 'YYYY-MM-DD HH24:MI:SS'), 'YYYY-Q')
    Of

    /

    -----------------------
    Sybrand Bakker
    Senior Oracle DBA

Maybe you are looking for