Discussions

Expand all | Collapse all

Find duration between 2 fields with data type (Time of day) ?

  • 1.  Find duration between 2 fields with data type (Time of day) ?

    Bronze
    Contributor
    Posted 12-13-2017 15:16
    How to find duration when start date field is of type (Time of day) and end date field is of type (time of day). I need to find the total duration between start date and end date in terms of days and hours.


  • 2.  RE: Find duration between 2 fields with data type (Time of day) ?

    Posted 12-13-2017 15:25
    There is not enough information to be able to do that calculation, since we do not know the day of the start and the stop.

    You need to record the start date and the start time and the end date and the end time.  That can be done either with 4 fields or two fields of type "date/time".


  • 3.  RE: Find duration between 2 fields with data type (Time of day) ?

    Top
    Contributor
    Posted 12-13-2017 15:34
    ToDays([tod2] - [tod1]) will return a number as fraction of a day. 

    ToHours([tod2] - [tod1]) will return the number of integer hours and a decimal representing the fraction of hours.



  • 4.  RE: Find duration between 2 fields with data type (Time of day) ?

    Posted 12-13-2017 15:40
    ... assuming that all data entry is done on the same day and does not cross midnight.

    I was confused because Raj said "in terms of days and hours.


  • 5.  RE: Find duration between 2 fields with data type (Time of day) ?

    Bronze
    Contributor
    Posted 12-13-2017 16:02
    Do you mean the start date and end date should be same day? My use case is something like this:

    Start date can be 1st dec and end date can be 5th dec. Also I need to know the time of start day and end day so I can display a result. For example: "Outage Duratio" was 4 days and 7 hours. Can this be achieved?


  • 6.  RE: Find duration between 2 fields with data type (Time of day) ?

    Posted 12-13-2017 16:07
    Yes no problem, but let me know what you are fields are which are capturing the start date and end date.  i suggest that you make fields for those and btw, a user tip is that if you type a T into a date field it will populate to today.

    So you may want to default the start date to the current day and then users will type a T to set the date when the ticket is closed, as well as the time.  or else you can have a form rule to check a checkbox that will set the  end date to today and the end time to now.


  • 7.  RE: Find duration between 2 fields with data type (Time of day) ?

    Bronze
    Contributor
    Posted 12-14-2017 16:02
    Thank you for your help, I tweaked my field types and was able to find the solution in "Days Format". 


  • 8.  RE: Find duration between 2 fields with data type (Time of day) ?

    Top
    Contributor
    Posted 12-13-2017 15:43
    I was confused because I answered a question without using JavaScript. Its gonna be a bad day - we have 7 inches of snow coming ...