Answered
Calculate the time difference between two different hours in a day
Hello, is there a similar function in the above function CHelper.getEffectiveDuration (Me, start date, end date) which is for calculating the difference between two dates. Is there a difference of two different hours in a day? If not, is there another way to code? Explain the reason for asking this question with a famous example, the application process. For example, in this process, when the user is on a daily leave, we can use the above function to display the difference between the start and end dates at the same time to the applicant in the requested number of days field. But if the leave is of the hour type, how can we show the requested hour amount to the applicant at the same time ??????????? I am waiting for your response . Thanks
Hi Iman,
Here is an example that will work for you:
var dDate1 = new DateTime(2021,09,21,15,0,0);
var dDate2 = new DateTime(2021,09,25,16,10,0);
var iMinutes = (dDate2-dDate1).TotalMinutes;
var iHours = (dDate2-dDate1).TotalHours;
CHelper.ThrowValidationAlert("Difference in minutes: "+ iMinutes +", OR in hours: "+ iHours);
The above code calculates the minutes/hours between two dates, including non-working days.
Thank you Mr. Valeriu Bosneaga
Comments have been locked on this page!