How to use calculated time between in sharepoint

Örnvall Andreas 0 Reputation points
2025-12-11T07:44:55.0633333+00:00

Hello i am doing this code in sharepoint lists but get syntax error when doing this, what can i do instead?

User's image

User's image

User's image

Microsoft 365 and Office | SharePoint | Development
0 comments No comments
{count} votes

4 answers

Sort by: Most helpful
  1. Dimple Rane 1,231 Reputation points
    2025-12-11T08:33:08.7366667+00:00

    In SharePoint lists, you can calculate the time difference between two Date/Time columns using a calculated column formula. The key is to store both columns as Date and Time (not just Date) and use the DATEDIF or subtraction approach depending on the needed time unit.

    Example

    If you have columns:

    • StartTime (Date and Time)
    • EndTime (Date and Time)

    Then create a Calculated column named Duration with this formula:

    
    =([EndTime]-[StartTime])*24
    
    

    This returns the difference in hours.

    To get minutes, multiply by 24*60; for days, remove the multiplier.

    Notes

    • SharePoint stores dates as serial numbers, so subtracting two date/time values gives the difference in days (Microsoft Docs: Calculated Field Formulas).
    • Ensure both fields include time values; otherwise, SharePoint assumes midnight and results may appear off.
    • If you need to show the result as a friendly text like “2 hrs 15 mins,” concatenate parts:
    
    =INT(([EndTime]-[StartTime])*24) & " hrs " & INT(MOD(([EndTime]-[StartTime])*24*60,60)) & " mins"
    
    

    For Modern Lists or Power Apps

    If you need more flexible formatting or time-zone handling, use a Power Apps customized form and calculate the difference using the DateDiff() function (reference).

    In short:

    Use a calculated column with date subtraction, multiply to the desired unit, and format as needed. Ensure both fields include time for accurate results.


  2. Jayden-P 12,705 Reputation points Microsoft External Staff Moderator
    2025-12-11T09:37:08.9533333+00:00

    Hi @Örnvall Andreas

    Thank you for posting your question in the Microsoft Q&A forum.

    Make sure that your Start and End date columns include date and time.

    You can use this to calculated how many days in between the columns.

    =INT([End date]-[Start date]) & "d "
    & INT( MOD( ([End date]-[Start date]) * 24 , 24 ) ) & "h "
    & ROUND( MOD( ([End date]-[Start date]) * 1440 , 60 ) , 0 ) & "m"
    
    

    User's image

    The outcome should look like this.

    User's image

    Please let me know if you need something else.

    I hope this helps.


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".   

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

  3. Örnvall Andreas 0 Reputation points
    2025-12-11T09:48:36.5933333+00:00

    I tried this now but still get syntax error

    User's image

    User's image


  4. Örnvall Andreas 0 Reputation points
    2025-12-11T10:30:25.7766667+00:00

    Sjkjkjkhjkhjkhjkhjjk


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.