Date difference and format

Hi @A_Learner

Please check the below thread:

You can try below way for example:

startDate= DateTime.Now.AddDays(-1)
endDate= DateTime.Now.AddHours(1)
timeDifference= (endDate - startDate).ToString("hh\:mm\:ss")

startDate, endDate is of DataType System.DateTime. timeDifference is of DataType System.String.

If you have any specific date formats mention that format, I will help you out with the syntax.


1 Like