• Resolved amirdorna

    (@amirdorna)


    Hi

    I have some calculation fields that supposed to show the result of calculation as (HH:MM),
    now it is showing as i.e. 3.84 How should I change it to show 3:50 ?

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author codepeople

    (@codepeople)

    Hello @amirdorna,

    Could you describe the equation, please?

    You should use the CDATE operation. I’ll try to describe the process with an example:

    Assuming you are using the free version of the plugin and the Date/Time field is the fieldname1, and finally you want add to it the number of minutes entered through the fieldname2. As the default operation is based on days, you should convert the fieldname2 to milliseconds, as follows:

    
    fieldname2*60*1000/(24*60*60*1000)
    

    So, the final equation in this case would be:

    
    CDATE(fieldname1+fieldname2*60*1000/(24*60*60*1000), 'hh:ii')
    

    hh for hours and ii for minutes.

    The previous equation returns results with the format 3:50

    Best regards.

    Thread Starter amirdorna

    (@amirdorna)

    Hi

    I have bought the Developer version.

    Im using different equation. But as an example,

    (((fieldname13+fieldname12)*2)*fieldname16)/133

    It calculate the Baseboards in a room and by dividing it to 133, it give the time needed to paint it.

    Now if we consider a room 10×10, the result will be 0.66

    I want this to show 00:39

    Plugin Author codepeople

    (@codepeople)

    Hello @amirdorna,

    Please, indicate what means each of fields: fieldname12, fieldname13 and fieldname16. If you are not using date/time fields, in some way you need a conversion between float numbers and time results, what is the conversion are you using in your project?

    Best regards.

    Thread Starter amirdorna

    (@amirdorna)

    Fieldname 12 : lenght of room
    fieldname 13 : width of room

    fieldname 16 : how many paint coat to paint that

    Plugin Author codepeople

    (@codepeople)

    Hello @amirdorna,

    If the fields in the equation represent length and width, etc. you are not calculating time, you would be calculating a result corresponding to area or similar, but you need to indicate the how the measurement unit is converted to time.

    I’ll try to describe the process with an example: Assuming that fieldname1 represent length, and fieldname2 width, and you need 5 minutes for painting 1 square meter, and finally you want to calculate the time required for painting the room, the equation might be similar to:

    
    (function(){
    var area = fieldname1*fieldname2,
    time = area*5,
    hours = FLOOR(minutes/60),
    minutes = minutes%60,
    result = '';
    
    if(hours < 10) result += '0'+''+hours;
    else result += hours;
    result += ':';
    if(minutes < 10) result += '0'+minutes;
    result+= minutes;
    
    return result;
    })()
    

    Now, you should follow the same logic in your project.

    Best regards.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Decimal Number to HH:MM’ is closed to new replies.