Announcement

Collapse
No announcement yet.

Calculate days/hours/minutes between two date fields

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Calculate days/hours/minutes between two date fields

    Hi,

    I used below method to calculate days between 2 date fields. I need to calculate and get days/hours/minutes for a field and it should show as Eg - 2 days 10 hour 30 minutes or like any easy way. Is it possible ?


    $durationMinutes = (datetime\format(EndDate, 'UTC', 'U') - datetime\format(StartDate, 'UTC', 'U')) / 60;
    $hours = number\floor($durationMinutes / 60);
    $minutes = ($durationMinutes / 60 - $hours) * 60;

    NoofDays = string\concatenate($hours, ':', $minutes) / 24;
    Cheers!
    Nishan.

  • #2
    Hi,

    Can anyone help me on this ????
    Cheers!
    Nishan.

    Comment

    Working...
    X