Future Date Script in Acrobat, 6 months after current date

Hey guys I have been working on this for hours and I am not sure why I cannot figure this out.  I am looking to have 1 field box in the form auto populate the current date and another field box to auto populate a date 6 months from the current date.  My current date code is attached, I have been playing around with so many variations that I do not want to confuse anyone with my other ugly code fragments.
var bFirstTime=1;
var f=this.getField("todaysDate");
if (bFirstTime=1) {
f.value=util.printd("mm/dd/yyyy",new Date());
bFirstTime=0;
//app.bFirstTime);

Have you tried a document level funtction that runs when the PDF is opened. The following script fills in today's date if the field has not been field in and computes the date in 5 months using the parts of the date and the value of today's date.
// one time use document level function
( function () {
// update fields only if balnk
if(this.getField('todaysDate').defaultValue == '') {
// get current date time object
var oNow = new Date();
// get some date parts
var fYear = oNow.getFullYear(); // 4 digit year
var fMonth = oNow.getMonth(); // get zero based month
var fDate = oNow.getDate(); // get date of month
var sFormat = '%,302.0f/%,302.0f/%,304.0f';
// fill in field
this.getField('todaysDate').value = util.printf(sFormat, (fMonth + 1), fDate, fYear);
// make permanent
this.getField('todaysDate').defaultValue = this.getField('todaysDate').value;
// compute date 6 months from today
fMonth += 6;
var oNew = new Date(fYear, fMonth, fDate);
// get some date parts
fYear = oNew.getFullYear(); // 4 digit year
fMonth = oNew.getMonth(); // get zero based month
fDate = oNew.getDate(); // get date of month
// fill in field
this.getField('newDate').value = util.printf(sFormat, (fMonth + 1), fDate, fYear);
// make permanent
this.getField('newDate').defaultValue = this.getField('newDate').value;
// debugging aid
app.alert('dates updated', 2, 0);
} else {
app.alert('dates not updated', 1, 0);
} // end not empty
return;
} // end function
() // call funtion
); // end document level function

Similar Messages

  • Mdx query to get the last date of every month if the month is current month need current date..

    i have a scenario where i need the data of last date of every month and if the month is current month need current date data...
    is it possible using MDX...

    Hi Shashi,
    According to your description, you want to return the last day for each month except current month, right?
    In MDX, we can use ClosingPeriod function to return the member that is the last sibling among the descendants of a specified member at a specified level, here is a sample query for you reference.
    with member [measures].[a]
    as
    ClosingPeriod ([Date].[Calendar].[Date],[Date].[Calendar].currentmember).name
    select {[measures].[a]} on 0,
    [Date].[Calendar].[Month].members on 1
    from
    [Adventure Works]
    And then use the IIF function to evaluate if the month is current month. Please refer to the links below.
    http://msdn.microsoft.com/en-us/library/ms145584.aspxhttp://msdn.microsoft.com/en-IN/library/ms145994.aspx
    Regards,
    Charlie Liao
    TechNet Community Support

  • How to get name of the month from current date.

    Hi,
       How to get the name of the month from current date.
    Thanks,
    Senthil

    Sethil,
    Use your date(let us say Date1) instead of sy-datum.
    CALL FUNCTION 'MONTH_NAMES_GET'
    EXPORTING
    LANGUAGE = SY-LANGU
    IMPORTING
    RETURN_CODE =
    TABLES
    MONTH_NAMES = itab_month
    EXCEPTIONS
    MONTH_NAMES_NOT_FOUND = 1
    OTHERS = 2
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    READ TABLE itab_month
    WITH KEY MNR = date1+4(2).
    itab_month-LTX will contain the value you are looking for
    Good luck
    Raghava

  • Subtracting months from current date

    how to subtract months from current date in mysql

    You are in an Oracle forum, so the Oracle answer is: use add_months(sysdate,-2) to subtract two months from the current date.
    Regards,
    Rob.

  • Get last august month from current date

    Hi,
    I need to get last august month from current date.
    e.g if current date is 1-OCT-2013 need to get last August date i.e.1-AUG-2013
    e.g. if current date is 1-MAY-2013 need to get last August date i.e.1-AUG-2012

    Something like this?
    SQL> WITH table_x AS(
      2     SELECT SYSDATE dt from dual UNION ALL
      3     SELECT TO_DATE('20-05-2013','dd-mm-yyyy') from dual
      4  )
      5  --
      6  ---
      7  --
      8  SELECT  dt,
      9    CASE
    10      WHEN (dt >= Add_Months(TRUNC(dt,'YEAR'),7)) THEN
    11          Add_Months(TRUNC(dt,'YEAR'),7)
    12      WHEN (dt < Add_Months(TRUNC(dt,'YEAR'),7)) THEN
    13          Add_Months(TRUNC(dt,'YEAR'),7) - 365
    14    END cs
    15  FROM table_x;
    DT        CS
    24-OCT-13 01-AUG-13
    20-MAY-13 01-AUG-12

  • Create prompt with date-filter and initialize it with current date

    Oracle BI 11 g
    Hi!
    I need to create dashboard prompt with date-filter and initialize it with current date. How can I do that?
    I tried to create repository initialization block and add variable. But I don't know what should I write to DataSource? I tried to use functions Now(), Current_Date, sysdate (for example, SELECT Now() FROM tbl_Calendar) but without results - when I pressed "Test..." button I got errors - something like "Now() is unknown function" or "Incorrect syntax near key word Current_Date".
    After that I tied to use Presentation Variable in Prompt, but also without success ((
    Please, help me.

    I've created Repository Variable "CurrentDate", using SQL-query like this "select convert(varchar(10), getdate(), 104)" and now this variable is being initialized by value "07.04.2011". But I don't understand how to use this varible in DashboardPrompt! What item in list "Default selection" I should choose - "Variable Expression", "Server Variable" or something else? When I chose "Variable Expression" and write "CurrentDate" I got just string "CurrentDate" when preview Prompt. @{CurrentDate} gave me the same result.

  • How to only show data that hasn't passed the current data?

    I have some data in an xml file. I can get it to connect fine to an .html page. My question is how do I only show the data that hasn't passed the current date? Can this be done?

    The following is the XML file
    <?xml version="1.0" encoding="utf-8"?>
    <sports>
         <item>
              <date>2010-03-21</date>
              <opponet>Essendon</opponet>
              <location>MCG</location>
              <time></time>
         </item>
         <item>
              <date>2011-01-11</date>
              <opponet>Collingwood</opponet>
              <location>Etihad</location>
              <time></time>
         </item>
         <item>
              <date>2011-03-04</date>
              <opponet>Carlton</opponet>
              <location>Princes Park</location>
              <time></time>
         </item>
         <item>
              <date>2011-03-08</date>
              <opponet>Sydney</opponet>
              <location>SCG</location>
              <time></time>
         </item>
         <item>
              <date>2011-03-21</date>
              <opponet>Brisbane</opponet>
              <location>Gabba</location>
              <time></time>
         </item>
    </sports>
    The following is the HTML
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xmlns:spry="http://ns.adobe.com/spry">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Untitled Document</title>
    <script src="SpryAssets/xpath.js" type="text/javascript"></script>
    <script src="SpryAssets/SpryData.js" type="text/javascript"></script>
    <script type="text/javascript">
    function pad(number, length) {
         var str = '' + number;
         while (str.length < length) {
              str = '0' + str;
         return str;
    var dt= new Date()
    var today = dt.getFullYear()
        + '-' + pad(dt.getMonth()+1,2)
        + '-' + pad(dt.getDate(),2);
    var ds1 = new Spry.Data.XMLDataSet("asdf.xml", "sports/item[date > '"+today+"']", {sortOnLoad: "date", sortOrderOnLoad: "ascending", useCache: false});
    alert (today);
    </script>
    </head>
    <body>
    <div spry:region="ds1">
    <table>
        <tr>
          <th spry:sort="date">Date</th>
          <th spry:sort="opponet">Opponet</th>
          <th spry:sort="location">Location</th>
          <th spry:sort="time">Time</th>
        </tr>
        <tr spry:repeat="ds1" spry:odd=".atl" spry:hover=".alt">
          <td>{date}</td>
          <td>{opponet}</td>
          <td>{location}</td>
          <td>{time}</td>
        </tr>
      </table>
    </div>
    </body>
    </html>
    Gramps

  • User start date can not be before the current date

    I'm creating users using the Reconciliation engine. The start date attribute doesn't appear to be reconciling. I get many different types of parse errors. The closest I appear to get is when I set the Xellerate User resource object recon field to have Start date as a date field, i receive the error:
    "User start date can not be before the current date.".
    I'm using 9.0.1.1. And I AM trying to create a user that has a start date before todays date.

    Resolution was to patch to 9.0.1.1578

  • Need help with SQL retrieval for previous month till current date

    Hi ,
    Need help generating statistics from previous month from date of enquiry till current date of enquiry.
    and have to display it according to date.
    Date of enquiry : 03/02/2012
    Application Type| 01/01/2012 | 02/01/2012 | 03/01/2012 |...... | 31/01/2012 | 01/02/2012 | 02/02/2012 | 03/02/2012 |
    sample1 20 30 40
    sample 2 40 40 50
    sample 3 50 30 30
    Hope you guys can help me with this.
    Regards

    Hi,
    932472 wrote:
    Scenario
    1)If i run the query at 12 pm on 03/2/2012. the result i will have to display till the current day.
    2)displaying the count of the application made based on the date.
    Application type 01012012 | 02012012 | 03012012 | ..... 01022012| 02022012|03022012
    sample 1 30 40 50 44 30
    sample 2 35 45 55
    sample 3 36 45 55Explain how you get those results from the sample data you posted.
    It would help a lot if you posted the results in \ tags, as described in the forum FAQ. {message{id=9360002}
    SELECT     application_type as Application_type
    ,     COUNT (CASE WHEN created_dt = sysdate-3 THEN 1 END)     AS 01012012 (should be getting dynamically)
    ,     COUNT (CASE WHEN created_dt = sysdate-4 THEN 1 END)     AS 02022012
    ,     COUNT (CASE WHEN created_dt = sysdate-5 THEN 1 END)     AS 03022012
    , COUNT (CASE WHEN created_dt = sysdate-6 THEN 1 END)     AS 04022012
    FROM     table_1
    GROUP BY application_type
    ORDER BY     application_typeThat's the bais idea.
    You can simplify it a little by factoring out the date differences:WITH got_d     AS
         SELECT     qty
         ,     TRUNC ( dt
              - ADD_MONTHS ( TRUNC (SYSDATE, 'MON')
                        , -1
              ) AS d
         FROM table1
         WHERE     dt     >= ADD_MONTHS ( TRUNC (SYSDATE, 'MON')
                        , -1
         AND dt     < TRUNC (SYSDATE) + 1
    SELECT     SUM (CASE WHEN d = 1 THEN qty END)     AS day_1
    ,     SUM (CASE WHEN d = 2 THEN qty END)     AS day_2
    ,     SUM (CASE WHEN d = 62 THEN qty END)     AS day_62
    FROM     got_d
    See the links I mentioned earlier for getting exactly the right number of columns, and dynamic column aliases.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Propose delivery date in Sales order to pick current date

    Hi,
    I want to set the delivery date in SO to pick the current system date. Users should be able to change it to a future date <b>but not to a past date</b>.
    Can anyone advice on how this can be done? I tried VOV8, but still, it didnt get determined properly.
    Any advice?
    Thanks
    Keshi

    Hi,
    In VOV8 if you click on the popose delviery date then the system will determine the delivery date as today's only. If the users try to change the delivery date in the past then the system will give a warning but it will be changed.
    In the sales screen of the sales order the date which is there is the "<b>requested delivery date of the customer"</b> This is the date by which the customer is expecting the material at his/her place. You can change it to the past but schedule line will not allow you to deliver the material in the back date.
    But for the particular item if you go in the schedule lines try changing the delivery date in the past. The system will create 2 schedule lines and the schedlue line for today's date only will be confirmed. So no question of delivery in the past date.
    Hope this clarifies your doubt. Reward points if solution helps.
    Regards,
    Allabaqsh G. Patil

  • How can data in cube will update after Master data changes

    Hi,
    We have a Revenue cube which we are loading actuals after every month.
    Now we have master data changes at profit center level. Profit center is moving from Holdings to Power, effective with October reporting.  So master data we updated accordinglt now we need to update data in cube.
    I want know how can we update all the data in cube without dropping and relaoding again.
    We have DS0s first then cube.
    Please let me know available options.
    Thanks
    Sivaprasad

    Hi,
    Make the field which stores data whether it is holding or power as navigational attribute of profit centre.
    So whenever master data changes just update profit center master data . Use this nav attribute in reports.
    So whenever master data changes report changes automatically.
    If you want time dependant 2008 to 2009 Holdings then 2007 power enable profit center time dependant master data.
    Hope it helps.
    Thanks,
    Arun

  • How can I set the date field to auto populate the current date?

    I have many forms to create where the current date dictates a specific change in options or conditions for the form filler to follow. I cannot see any way to handle that issue. Is it possible to simply set the current date as a default?
    jcytrny

    Sorry, we currently do not support having today's date show up in a date field by default
    Randy

  • Date should not be  less than current date.

    Hello, I have a form.It has an item called end_date. I want to have validation of end_date in such a way that "end_date should not less than current date". Any tips would be helpful.
    Thanks in advance.

    jwellsnh wrote:
    Pravish,
    A dynamic action executing JavaScript can do this:
    Create a Dynamic Action:
    Event Before Page Submit
    Condition JavaScript Expression
    Value $v('P1_END_DATE')<$v('P1_BEGIN_DATE')In this scenario; P1_BEGIN_DATE would need to default to sysdate and could be a hidden item on the page.
    Jeff
    Edited by: jwellsnh on Jul 19, 2012 9:50 AMMaybe I'm missing something but isn't this just a use case for a common-or-garden validation? Would be interested to know why you thought of javascript rather than normal built-in functionality (not meant as a criticism incidentally!) - is javascript your first port of call when it comes to APEX?
    I'd also watch out for comparisons to SYSDATE - remember that SYSDATE includes the current time, so you'd need to take that into account (maybe you could make use of the TRUNC function to remove the time element?). Indeed, would javascript evaluate that expression as comparing two dates (I know Javascript evaluates variables byDuck Typing but does this work in practice)?

  • How to get previous 2 months from current date in a dropdown?

    Hello Experts ,
                           In the application which I am developing, there is a requirement wherein , I want to Populate current month and previous two month in a drop down depending upon today's date. please help.
    Thanks & Regards,
    Pratbha Shukla

    The internal format for dates is yyyymmdd.  Therefore you can just grab the month value from the date:
    data lv_month type FCMNR.
    lv_month = lv_date+4(2).
    Just subtract from the month to get the two previous.
    data lv_previous1 type FCMNR.
    data lv_previous2 type FCMNR.
    if lv_month = 1.
    lv_previous1 = '12'.
    else.
    lv_previous1 - lv_month - 1.
    endif.
    if lv_previous1 = 1.
    lv_previous2 = '12'.
    else.
    lv_previous2 - lv_previous1 - 1.
    endif.
    Then do your lookup for the month name by reading the table returned from function module MONTH_NAMES_GET.

  • C03 Error - 1.5 Months after activation date still...

    Hi,
    I ordered BT vision and broadband back at the start of April. Activation date was 21st April. Broadband worked straight away but I received the c03 error on my bt vision service. 9 Calls later still no further forward. Each call they helpline people, that's either Technical support, order management or other groups, all have come up with different theories and 'fixed' them. Each time with a 24-48 hour wait and the promise of a call back. Obviously each time no joy and no call back.  Additionally I then received another welcome pack last week with a new activation date of June 2nd - again no difference to the service.
    Main theory seems to be that the Vision is on the correct phone line and that the broadband is on a wrong line. This however can only be fixed by a 'back -office' department which I'm not allowed to speak to. And after several requests from the helpline to them I was told it had been changed and was fixed. However on my call today I was told that this had not been done. Was also told if I wanted to cancel my service there would be penalty charges!
    Please can a mod sort this out?
    Thanks
    James

    Hello Jamesrycroft and welcome,
    You can point the mods to this thread using this form:
    http://bt.custhelp.com/app/contact_email/c/4951
    They take up to 72 hours to respond.
    Hope you get your problem sorted.

Maybe you are looking for

  • Blue screen while trying to open the applications folder?

    While using safari, or when clicking the Applications folder, my MacBook will turn completely blue and then go to the desktop as if it were just restarted. I tried installing fire fox to see if it was a safari thing but it still does it. I've called

  • Speakers that look very nice with aluminum iMac?

    I'm looking to purchase speakers for my iMac and I haven't found any that look great and also get good reviews. I'm willing to spend up to about $200 CDN. I have the aluminum iMac. I will be using the speakers mostly to watch TV/video so I don't need

  • External SSD disconnects randomly

    I have a new MacBook Pro Retina 13". Because storage space is limited, I'm using a Samsung SSD as an external drive. This drive is in a USB 3.0 a case from OWC. The Aperture library I'm working from lives on that drive, so it needs to be a reliable c

  • General place for newbie datamodeler questions?

    With the production release of SQL Developer Data Modeler I'd assume that this forum will draw a bunch of new users. Is there a better place to ask some pretty simple, newbie like questions that won't bother the more seasoned members? For instance, I

  • Creating a new position and updating IT 1028 using HCM processes and forms

    I have to create a new position and update the related infotypes using the design time framework of HCM processes and forms. The problem I am facing is the info type 1028 is not a part of the de coupled infotype framework and does not appear in the s