• Resolved klingbeil

    (@klingbeil)


    Hello;
    Where am I doing wrong on this code?

    fieldname16 = It refers to the number of days in the previous date calculation.

    nekadarzaman1 = Calculates total seconds.

    var nekadarzaman = DECIMALTOTIME(nekadarzaman1 ,”s”,”d days, h hours, i minutes, and s seconds”);

    I can’t distribute the total seconds to the results I want here.
    In other words, how many hours, how many minutes and how many seconds is the result of the seconds.

    	var nekadarzaman1 = PREC((fieldname16*24)*60*60, 0, true);
        var nekadarzaman = DECIMALTOTIME(nekadarzaman1 ,"s","d days, h hours, i minutes, and s seconds");
        jQuery('#calculation-nekadarzaman').html(nekadarzaman + ' berabersiniz.');
        jQuery('.nekadarzaman-aciklama').html('Zaman Süresi :');
        jQuery('.nekadarzaman-sonuc').html(nekadarzaman + ' berabersiniz.');
    
        return nekadarzaman;
      }
Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Author codepeople

    (@codepeople)

    Hello @klingbeil

    Thank you very much for using our plugin. I’m not sure who is fieldname16. But if it has the number of days, and you want to transform it into hours, minutes and seconds, you can implement the equation as follows:

    
    (function(){
    var nekadarzaman1 = TIMETODECIMAL(fieldname16, 'd', 's');
    var nekadarzaman = DECIMALTOTIME(nekadarzaman1, 's', 'h hours, i minutes, and s second');
    
    jQuery('#calculation-nekadarzaman').html(nekadarzaman + ' berabersiniz.');
    jQuery('.nekadarzaman-aciklama').html('Zaman Süresi :');
    jQuery('.nekadarzaman-sonuc').html(nekadarzaman + ' berabersiniz.');
    })()

    Best regards.

    Thread Starter klingbeil

    (@klingbeil)

    minutes and seconds came as 0 I wonder is something missing?
    The hour has come.

    Plugin Author codepeople

    (@codepeople)

    Hello @klingbeil

    If the value of the fieldname16 field is an integer number representing days, the minutes and seconds would be 0.

    I’ll try the same operations, but using a decimal value (1.53 days)

    This time, since the initial value is a decimal, it includes minutes and seconds.

    Best regards.

    Thread Starter klingbeil

    (@klingbeil)

    fieldname16 represents the number of days. I leave the sample form at the bottom.

    Sample

    Live Preview

    • This reply was modified 1 year, 5 months ago by klingbeil.
    Plugin Author codepeople

    (@codepeople)

    Hello @klingbeil

    The fieldname16 equation returns an integer number representing whole days. Transforming this value to hours, minutes, and seconds will give you the number of hours, but the remaining minutes and seconds would be zero. You can check this by performing the calculations manually.

    Best regards.

    Thread Starter klingbeil

    (@klingbeil)

    Hello;
    Is the equation correct?

    (function(){
    var nekadarzaman1 = TIMETODECIMAL(fieldname16, 'd', 's');
    var nekadardakika = nekadarzaman1 * 60
    var nekadarsaniye = nekadardakika * 60
    var nekadarzaman = DECIMALTOTIME(nekadarzaman1, 's', '<span style="font-size: 80%;">h saat, nekadardakika dakika, nekadarsaniye saniye</span>');
    
    jQuery('#calculation-nekadarzaman').html(nekadarzaman);
    jQuery('.nekadarzaman-aciklama').html('Birliktelik Zaman? :');
    jQuery('.nekadarzaman-sonuc').html(nekadarzaman);
    })()
    Plugin Author codepeople

    (@codepeople)

    Hello @klingbeil

    No, your equation has no sense. If you want to calculate something similar to:

    1 day is equal to 24 hours, 1440 minutes, and 86400 seconds

    The equation could be implemented as follows:

    
    (function(){
    var nekadarzaman1 = TIMETODECIMAL(fieldname16, 'd', 's');
    var nekadardakika = DECIMALTOTIME(nekadarzaman1, 's', 'h');
    var nekadarsaniye = DECIMALTOTIME(nekadarzaman1, 's', 'i');
    var nekadarzaman = CONCATENATE('<span style="font-size: 80%;">', nekadardakika,' saat, ', nekadarsaniye,' dakika, ', nekadarzaman1,' saniye</span>');
    
    jQuery('#calculation-nekadarzaman').html(nekadarzaman);
    jQuery('.nekadarzaman-aciklama').html('Birliktelik Zaman? :');
    jQuery('.nekadarzaman-sonuc').html(nekadarzaman);
    })()

    Best regards.

    Thread Starter klingbeil

    (@klingbeil)

    Thank you very much for your support.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Calculating Decimal Value’ is closed to new replies.