Difference of field calculation date

Hi all

I am new to Adobe and Java script so apologies if this has already been answered elsewhere - I was not able to find it if it has.

I want to calculate the difference between two date fields in hours and minutes on a form.

I have two fields, the Date format (dd/mm/yyyy hh: mm), a start and end date and I want the difference between them at the time in the format hh: mm.

Can someone help me with the script for this? What I have so far is:

var strStart = this.getField("StartTime").value;

var strEnd = this.getField("EndTime").value;

if(strStart.Length || strEnd.Length)

{

var dateStart = util.scand ("mm/dd/yyyy hh: mm", strStart);

var dateEnd = util.scand ("mm/dd/yyyy hh: mm", strEnd);

diff var = dateEnd.getTime () - dateStart.getTime ();

One day = (24 hours) x (60 minutes/hour) x

(60 seconds/minute) x (1000 milliseconds per second)

var oneMin = 60 * 60 * 1000;

var minutes = Math.floor (diff/oneMin);

Event.Value = util.printd("HH:MM",mins);

}

But it does not work...

Mary

Got it - Thanks for your help - really appreciate it.

Tags: Acrobat

Similar Questions

  • The years between 2 fields calculation date

    I have am trying to create a form in LiveCycle Designer 7 missing persons report.  I want to fill in a text field with the number of years between two dates entered in date/time fields; specifically using the DOB of a missing person and the date they have been seen to calculate their age during the last time.

    Any help would be greatly appreciated.

    Thank you

    Drew

    FormCalc has a "A Value()" function that returns "true" only when the field has been updated, you can add an if statement uses the function 'Value() a' for both fields and return a true result only when both fields have given.

  • Field calculated MDB a max date using rank

    Hello

    I need to get a maximum date within projects, and the date max must be a computed column. In the database there is the query I would use, how can I implement this in BMM, need help please, let me know if there is another way?

    Select a.commitment_date from
    (SELECT project, stage_id, commitment_date,
    DENSE_RANK() over (PARTITION BY project ORDER BY commitment_date desc) as rank
    of prod_detail) a
    Where rank = 1 a.project_id group;

    Thanks for your time and your help.

    Hi ssk.

    Your query in the DB online help, you can do 1 thing directly use this query in the physical layer and go to the-> new physical table and choose table type-> select and write SQL inside and paste this query it and joins appropriate to this table so he realized the extraction you want. So draw from this table to also be layer MDB.

    (GOLD)
    Take a new calculated column in the layer of MDB write it as max (commitment_date) and check the query SQL generated by BI server when you use this column in your application, by default, need to add group by clause adding columns to it.
    If you want to change the group by according to your requirement, and then go to the advance in the response criteria, find you the section group you specify a.project_id and check the results.

    Award points and close your previous message also @ssk field calculated MDB in the fact Table?

    See you soon,.
    KK

  • Custom calculation script runs not after that the field contains data entered

    I have a form that the user has entered the ZIP Code which is 6 characters with no spaces.  I take the 6 characters between and create another field that puts it in the ZIP Code format, but it only seems to work when they need to enter more information that isn't always the case.  Any ideas on how automatically update after only 6 first characters are entered?

    Here is my code:

    var s = this.getField("Postal_Code").valueAsString;

    If (s! = "" ") event.value = s.substring (0.3) +" "+ s.substring(s.length-3);

    else event.value = "zip_code";

    Thank you

    Cindy

    Here's what you would do in Acrobat 11, and I think that it is very similar to 10:

    First of all go in form editing mode: Tools > forms > change

    Then select: tasks > other tasks > set field calculation order

  • How to fill a field of date with today's date when the signature field is signed?

    How to fill a field of date with today's date when the signature field is signed? In the LCD, I insert a signature field and a date field, what parameters in these two fields are necessary to make this work? Is the date field, the value calculated? I tried different JS suggestions I found, but none work. In the form, I named the signature ClaimSignature field and the date in the ClaimSigDate field.

    The thought of her with a little help. In the script editor window, I selected the postSign event and added the following JS:

    Form1.Page1.ClaimSignature::postSign - (JavaScript, client)

    var date = new Date();

    var day = date.getDate ();

    var month = date.getMonth () + 1;

    var monthstring = (month, 10?) ('0' + month: month)

    year var = date.getFullYear ();

    var = year DateString + '-' + monthString + '-' + (day< 10="" "0"="" +="" day="" :="">

    ClsimSigDate.rawValue = dateString;

    I hope this helps someone else save time.

  • Calculating date in ActionScript

    I'm figuring a date in a form Flash based on the entry of field values. Basically the user enters a start date and a period in weeks, and I want to calculate and display the end date.

    I'm working on ActionScript code to hook to the onChange event of the field.

    The closest I got is:
    < cfsavecontent variable = "CalcContractExpiryDate" >
    ContractExpiryDate.text = ((ContractTerm.text) number * 7 * 24 * 60 * 60 * 1000) + Date (ContractDate.tex t);
    < / cfsavecontent >

    and then using "onChange = #CalcContractExpiryDate #"
    «but the '+' is an addition rather than a calculation, and I have values like ' 604800000Tue 6 Feb 07:57:59 GMT + 1100 2007»

    How to do the equivalent of a DateAdd in ActionScript?

    Thanks for your reply jedale.

    After much research and trying, here's what I had to work. Hope it helps you too.

    First of all, if you are wanting to use a European date (dd/mm/yyyy) format in your Flash forms, you must use

    to get the calendar to accept and validate the European dates.

    So if you want to make the DateAdd and DateDiff functions, go to this link: http://jeff.mxdj.com/dateadd_for_actionscript.htm
    Jeff Tapper has created a class that includes DateAdd and DateDiff, but the implementation in the CF is not explained.

    Copy the entire class down a bit in his functions in a file named DateFunction.as and save it in the same directory as your CF Flash page. You can now see its functions such as DateFunction.dateDiff and DateFunction.dateAdd.

    Its use is:
    DateFunction.dateDiff (datePart:String, date1:Date, date2:Date), and
    DateFunction.dateAdd (date: Date, datePart:String, num:Number)

    The dateDiff function is now expected to pass two dates defined as datefields, but I wanted to spend two text fields containing dates, because the routine was called when the date has had no development and therefore date1.selectedDate and date2.selectedDate were not contain the values that I needed. So I changed the first line of the dateDiff function and added a few lines, as follows:

    public static void dateDiff(datePart:String,_date1:String,_date2:String):Number {}
    var pieces = date1.split("/");
    var day = Number (parts [0]);
    var month = Number (parts [1]) - 1;
    year var = Number (parts [2]);
    var date1 = new Date (year, month, day);
    pieces = date2.split("/");
    day = Number (parts [0]);
    month = Number (parts [1]) - 1;
    an = Number (parts [2]);
    date2 var = new Date (year, month, day);
    Return getDateDiffPartHashMap() [datePart.toLowerCase ()](date1,date2);
    }

    Then I was able to use:
    var vDaysLeft = number (DateFunction.dateDiff ("d", _root. Date1.text, _root. Date2.text));

  • Customized for Acrobat field calculation script

    Hi, I have a field calculation script. I want to calculate exp (x), I want to link a X 'A' value. May I know what is the formula for this calculation?

    From another angle, I found at online, the operation is < 2.71 * X >, means 2.71 X power. But duno why <>* may not work to this end (power) to the custom calculation script.

    Do I know what other script can be created for exp (x).

    Please notify. Thank you.

    Of

    McCarthy

    Thank you all! I finally have the answer by myself already.

    Use this formula:

    Event.Value = Math.exp (this.getField("A").value)

    Yes!

  • REST API - the field value date Contact exported in digital format.

    Hi people,

    I used below REST API to retrieve the Contacts with the views and custom filter.

    The JSON response, I shot the date value in the number format. As 'C_Lead_Score_Date': '1434456862',


    https://secure.Eloqua.com/API/rest/1.0/data/contact/view/ {identifier} / contacts/filter / {id}


    How can I convert the appropriate number in date value? or y at - it an adjustment to the level of the code to retrieve the value in the correct date format.


    The data type of the field is dates.

    The date is returned to as a Unix timestamp.

    You can use an online converter to convert it to a normal value, for example: online - time conversion Conversion Unix

    1434456862 = Tuesday, June 16, 2015 12:14:22 GMT

  • Clear a field of data card/CDO

    Hello

    We are working on sending emails that will have a merge field to a data card/CDO object that is sometimes filled out and sometimes not; merged field of emails are sent through program generator when merging field no those are batched. After the merged field email is sent from the Builder program, we want to clear this field on the data card, so that if we batch email from contact with another email, the merger of field will be empty and not present information completely foreign to the emailed batch. Is it possible to do in E10? I can't find an option for it in the program generator. The only work around us would think has been implemented the merger of field as a piece of dynamic content and add a contact field that gets checked when the merger of field CDO / Data Card is necessary and not controlled when it's not like this can be done in the program generator.

    Hi Allan,

    If your goals is to update the field and future data communications player card... I think that there are few options, but the one I can suggest the use of the program generator.

    In the program generator.

    Create a program that takes the contacts it is a member.

    1. check if the email you want to send using email that address data slag is sent? If Yes

    2. take contact with Cloud connector for submit and add static value as empty (Leavve it blank)

    Form...

    3. create the form and map all data fields to a custom form to this exact object with a value field empty

    4. use and field to future communications drive additional Fusion by email.

    I would like to know if this helps or you are looking for.

    Thank you

    Amit

  • need help for calculation date

    I need help with this:

    I added successfully a document level script to add the date printed in my document

    this.getField("DatePrinted").value = util.printd ("mm/dd/yy", new Date());

    I now need to fill in a field named "Date" with a date that is 14 days after the date of DatePrinted.

    and I'm lost.

    Can anyone help?

    Get the current date/time

    var d = new Date();

    Add 14 days

    d.setDate (d.getDate () + 14);

    Set a field value

    getField("Deadline").value = util.printd ("mm/dd/yy", d);

    That last part may need to be changed depending on where you place the script. If it's the same script at the document level, the whole thing can be:

    Get the current date/time

    var d = new Date();

    Set a field value

    getField("DatePrinted").value = util.printd ("mm/dd/yy", d);

    Add 14 days

    d.setDate (d.getDate () + 14);

    Set another value of field

    getField("Deadline").value = util.printd ("mm/dd/yy", d);

  • How can I determine which text fields contain data?

    Although it is a sad testament to my programming skills, I'm little embarrassed because I'm only doing this sort of thing maybe once every two or three years.  I am using FormCalc (mainly b/c I'm still learning Javascript and this form had already been written in FormCalc).

    Here's the problem:

    I have three text fields (Textfield1, Textfield2, Textfield3).

    I created three variables (var1, var2, var3) and initialized to 0.

    To determine how many fields containing data, I used the if/then/else statements:

    If (Textfield1.rawValue == "") then

    var1 = 0

    on the other

    var1 = 1

    endif

    Textfield2 and Textfield3 have similar statements (respectively using var3 and var2 variables).

    To test the code, I have a message box returns the sum of var1 + var2 and var3.  With NOTHING entered into all fields of text, I expect him back a sum of 0, but it returns the sum of 3!  If I enter data in only one or two of the fields, yet once it returns a value of 3.

    I tried the initialization of the value of the Textfields (Textfield1.rawValue = ""), but I always get a value of 3.

    This is probably a simple programming error, but still, I'm not a developer.  Any help would be appreciated.

    I think that you may need to modify your code for: (replace the "with the null value). Change of FormCalc to Javascript

    If (Textfield1.rawValue == null) then

    var1 = 0

    on the other

    var1 = 1

    endif

  • How can I update form field with data using "on Blur.


    Perhaps also very easy for all the experts out there that you but I'm trying to update a form field with data in another field in the form when they come out the first form field.

    Basically creating a "billing" and a form "shipping" I want to be updated automatically.

    Any help would be extremely Grateful.

    Thank you

    Steve

    He does!

    shipFirstNameText.value = this.value

    It worked

  • Fill a field of Date format

    ODI, I'm trying to use a command sysdate to fill a field of Date format.
    As a result, I get the data in the table: June 17, 2009 * 00:00:00 *.
    But I want to see the Date and time.
    When you run the command SELECT to_char (sysdate, 'hh24:mi:ss of mon-dd-yyyy') FROM dual; I see 16 June 2009 20:16:09

    Why?

    ---
    Gelo

    I don't see why does not work...

    Please, what is the version of oracle target?

    Just to be sure, on the date fields, try to use, to target you mapping, the command:

    TO_DATE (to_char (sysdate, 'ddmmyyyy hh24miss'), "ddmmyyyy hh24miss")

  • Date of calculation of difference in field

    Dear all,

    I knew nothing about scripts..., but I work with adobe forms. I have a personal form let him join here where there are two fields ' From'(d/mmm/yy) and ' To'(d/mmm/yy). Now, there's a field more called "prevailed duration '(number format) to fill the number of days off." Can someone please help me get the "term" by the script... Help, please.

    A good starting point:

    https://acrobatusers.com/tutorials/working-with-date-and-time-in-Acrobat-JavaScript

    https://acrobatusers.com/tutorials/working-with-date-and-time-in-Acrobat-JavaScript-part-2

    https://acrobatusers.com/tutorials/working-with-date-and-time-in-Acrobat-JavaScript-part-3

  • Create only average column calculated date field

    Hello

    I am creating a single field at the bottom of a report to calculate the average number of days, based on the calculation of the 2 other fields date similar to this example below. I understand that I need a subquery, but can't seem to build the SQL correctly. In the table below is an example of what I'm trying to build, AVERAGE = 7.5.  The SQL code that I use to create the cycle time field that I'm trying to average is "ROUND (GLOGOWNER.» THE INVOICE. DATE_RECEIVED - GLOGOWNER. SHIPMENT_STOP. ACTUAL_DEPARTURE, 0) AS "" DURATION in days".

    SELECT ROUND (GLOGOWNER. THE INVOICE. DATE_RECEIVED - GLOGOWNER. SHIPMENT_STOP. ACTUAL_DEPARTURE, 0) IN the 'Cycle time in days.

    OF GLOGOWNER. SENDING

    JOIN INTERNAL GLOGOWNER. INVOICE_SHIPMENT

    ON GLOGOWNER. DELIVERY. SHIPMENT_GID = GLOGOWNER. INVOICE_SHIPMENT. SHIPMENT_GID

    JOIN INTERNAL GLOGOWNER. INVOICE

    ON GLOGOWNER. THE INVOICE. INVOICE_GID = GLOGOWNER. INVOICE_SHIPMENT. INVOICE_GID

    JOIN INTERNAL GLOGOWNER. SHIPMENT_STOP

    ON GLOGOWNER. DELIVERY. SHIPMENT_GID = GLOGOWNER. SHIPMENT_STOP. SHIPMENT_GID

    JOIN INTERNAL GLOGOWNER. SHIPMENT_STOP SHIPMENT_STOP1

    ON GLOGOWNER. DELIVERY. SHIPMENT_GID = SHIPMENT_STOP1. SHIPMENT_GID

    WHERE GLOGOWNER. DELIVERY. DOMAINNAME LIKE "UPS/CP/%B".

    AND GLOGOWNER. SHIPMENT_STOP. STOP_NUM = 1

    AND SHIPMENT_STOP1. STOP_NUM > 1

    ACTUAL_DEPARTUREDATE_RECEIVEDCycle in days time
    01/07/201414/07/201413
    04/07/201406/07/20142
    01/08/201411/08/201410
    02/08/201407/08/20145
    AVERAGE7.5

    Thank you very much for the help.

    Kind regards

    -Adam

    Add the "CUMULATIVE" at the end of the group by, and NOT in the select section

    SELECT Glogowner.Shipment.Domain_Name AS field

    , SUBSTR (Glogowner.Shipment.Servprov_Gid,-4) AS Scac

    , Glogowner.Shipment.Transport_Mode_Gid AS 'Mode '.

    CASE

    WHEN Ir.Insert_Date<= i.insert_date="" then="">

    WHEN I.Invoice_Source = 'I' and THEN 'EDI '.

    WHEN I.Invoice_Source = 'G' THEN 'debit '.

    WHEN I.Invoice_Source = am' THEN 'manual '.

    END

    AS a Source

    , Glogowner.Shipment.Shipment_Xid AS 'Expedition ID ".

    , Glogowner.Shipment_Stop.Actual_Departure AS "Delivery Date".

    , Shipment_Stop1.Actual_Arrival AS "Delivery Date".

    , I.Invoice_Number AS "invoice number".

    , I.Invoice_Date AS "Date of the invoice.

    , The LEAST (I.Insert_Date, Ir.Insert_Date) AS 'receipt of Invoice Date.

    , TOWER (I.Date_Received - Glogowner.Shipment_Stop.Actual_Departure, 0)

    AS of the time of Cycle "within days".

    INVOICE I have

    INNER JOIN Invoice_Refnum Ir ON I.Invoice_Gid = Ir.Invoice_Gid

    JOIN INTERNAL Glogowner.Invoice_Shipment

    ON I.Invoice_Gid = Glogowner.Invoice_Shipment.Invoice_Gid

    JOIN INTERNAL Glogowner.Shipment

    ON Glogowner.Shipment.Shipment_Gid =

    Glogowner.Invoice_Shipment.Shipment_Gid

    JOIN INTERNAL Glogowner.Shipment_Stop

    ON Glogowner.Shipment.Shipment_Gid =

    Glogowner.Shipment_Stop.Shipment_Gid

    INNER JOIN Glogowner.Shipment_Stop Shipment_Stop1

    ON Glogowner.Shipment.Shipment_Gid = Shipment_Stop1.Shipment_Gid

    WHERE Glogowner.Shipment_Stop.Actual_Departure IS NOT NULL

    AND Shipment_Stop1.Actual_Arrival IS NOT NULL

    AND Ir.Invoice_Refnum_Value = 'ACS '.

    AND Ir.Invoice_Refnum_Qual_Gid = 'SOURCE '.

    AND I.Invoice_Type = 'I '.

    AND Glogowner.Shipment_Stop.Stop_Num = 1

    AND Shipment_Stop1.Stop_Num > 1

    GROUP BY ROLLUP (AVG (ROUND (I.Date_Received - Glogowner.Shipment_Stop.Actual_Departure, 0)))

    ORDER BY I.Invoice_Gid;

Maybe you are looking for