Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
2 years ago
Solved

How to calculate difference between two dates

i want to calculate difference between created date and current UTC time, but its giving error. can someone plese guide here?  
  • PhilipTreacy's avatar
    2 years ago

    Hi Anonymous 

     

    You haven't said what the error is so I'm guessing as to what is in your Createddate column.

     

    Also you say you want to calculate the difference between a time and date.  I presume you mean the difference between two dates as you are looking for the Duration.Days

     

    Try this

     

     

    = Duration.Days(DateTime.Date( DateTime.LocalNow())  - [CreatedDate])

     

     

    Regards

     

    Phil