• Resolved mightykiwi

    (@mightykiwi)


    Hello,

    What would the equation be, to calculate time difference?

    I am trying to do up a time sheet for employees that will give the hours worked, when they enter in their start and finish time.

    Please help

    • This topic was modified 7 years, 9 months ago by mightykiwi. Reason: didn't select a box
Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author codepeople

    (@codepeople)

    Hello,

    If you are using any of the plugin’s versions that include the Date/Time module (the Developer and Platinum versions), and you want get the hours between two date fields where are enabled only the time sections, for example: fieldname1, and fieldname2, you should use an equation similar to the following one:

    DATEDIFF(fieldname2, fieldname1, 'hh:ii', 'h')['hours']

    If you want get the result with the format: hours:minutes, the equation would be:

    (function(){
    var result = DATEDIFF(fieldname2, fieldname1, 'hh:ii', 'h');
    return result['hours']+':'+result['minutes'];
    })()

    If your version of the plugin does not includes the Date/Time module, you should convert the date/time fields in javascript Date objects, and implement the equation calling the Date object methods (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date). For example, if you want to convert the fieldname1 in a Date object, the piece of code would be:

    var date_obj = new Date(fieldname1*86400000);

    Best regards.

    Thread Starter mightykiwi

    (@mightykiwi)

    Thank your awesome

    Thread Starter mightykiwi

    (@mightykiwi)

    Hello,

    I have brought and paid for the pro version, its awesome I might add.
    I am having trouble doing one thing. My site runs WP E member and I want the forms to be pre-fill out with ‘Last name, Fist Name and Company name’ all this information is already captured by E-member. The fields I am using are Line Txt DS, I then define the data source as ‘user data.
    This where I come stuck as only get a select list of Attribute for values:
    When I select ‘display_name’ I only get the First Name to generate up in my required field.
    I cant find any other values I want like ‘last name and company’
    What am i doing wrong? Is there another way?
    Please Help
    Kind regards

    Plugin Author codepeople

    (@codepeople)

    Hello,

    If you want to load custom attributes, you should select the database option as the datasource associated to the “DS” field. In this case you need to know the real name of the metadata.

    For example, assuming you have the “hidden DS” field: “fieldname1” to get the ID of the logged user, furthermore, I will assume that your WordPress is using the default database prefix: “wp_”, and you want get the user’s “Last Name”. The name of the metadata is “last_name”.

    Finally the query to use with the “Line Text DS” field would be:

    SELECT meta_value as value FROM wp_usermeta WHERE meta_key='last_name' AND user_id=<%fieldname1%>

    Best regards.

    Moderator Jan Dembowski

    (@jdembowski)

    Forum Moderator and Brute Squad

    I have brought and paid for the pro version

    For pro or commercial product support please contact the author directly on their site.

    As the author is aware, commercial products are not supported in these forums. As you are their customer I am sure they will have no problem supporting you there.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘length of time’ is closed to new replies.