Calculate the number of minutes.

Collapse
X
 
  • Time
  • Show
Clear All
new posts

  • victor
    commented on 's reply
    Describe your case in more detail.
    At first glance, the following formulas may suit you:
    - https://docs.espocrm.com/administrat.../#datetimediff
    - https://docs.espocrm.com/administrat...atetimeclosest

  • Ashif Malayil
    replied
    Is there any formula to find last 24 hours from Created At date and time?

    Leave a comment:


  • abidoss
    replied
    Thank you,

    Leave a comment:


  • BigBoss
    replied
    You can also add the days if necessary

    $totalMinutes = datetime\diff(dateFin, dateStart, 'minutes');
    $days = number\format(number\floor(($totalMinutes / (24 * 60)), 0));
    $remainingMinutes = $totalMinutes - ($days * 24 * 60);
    $hours = number\format(number\floor(($remainingMinutes / 60), 0));
    $minutes = number\format(number\floor(($remainingMinutes - ($hours * 60)), 0));

    Duration = string\concatenate($days, ' Days ', $hours, ' Hours ', $minutes, ' Minutes');

    Leave a comment:


  • ThomasB
    replied
    In my examples I used this:

    Code:
    impactDuration     Duration          Varchar
    incidentstarttime  Start of impact   Date-Time​​
    incidentEndtime    End of impact     Date-Time

    Leave a comment:


  • abidoss
    replied

    So, the "impactDuration" field is a text field, not a float.​

    Leave a comment:


  • ThomasB
    replied
    I'm using this formular to calculate the duration of an incident. Start and end time the incident.

    Code:
    $totalMinutes = datetime\diff(incidentEndtime, incidentstarttime, 'minutes');
    $hours = number\format(number\floor(($totalMinutes / 60), 0));
    $minutes = number\format(number\floor(($totalMinutes - ($hours * 60)), 0));
    
    impactDuration = string\concatenate($hours,' Hours ', $minutes, ' Minutes');​​

    Leave a comment:


  • abidoss
    replied
    Thank you, it works well for me too. However, if the time is more than 60 minutes, for example, 75 minutes, how do we display 1h15min?

    Leave a comment:


  • shalmaxb
    replied
    yes possible with datetime Diff

    minutes = datetime\diff(end, start, 'minutes');

    where end is in your case 10:10 and start 10:07

    I use this formula to calculate the time I need for a task. I put in start and end time and the minutes are calculated. In another field I convert the minutes to hours (float) and multiply with my hour rate to calculate the fee, my client has to pay for my work.
    Furthermore I reversed the calculation, e.g. I put in the start time and the minutes, from which then the end time is calculated. I did that for fun, because it is possible.

    Leave a comment:


  • abidoss
    started a topic Calculate the number of minutes.

    Calculate the number of minutes.

    Hello friends, is there a way to calculate the number of minutes and hours between two dates and display it in a field?


    For example, in the capture, the number of minutes is: 03 min.
Working...