In my app, I am getting a Date and start time of the same date and end time. The end time could be the time of very next day.
example : Date : 11/01/2011
start time : 5:30 PM
end time : 4:30 AM (of next day morning)
I am not getting the End Date.
How can I add one day into the start date based on the end time. I’ve referred many answers at SO but could not find the solution.
you should use this function
here 86400 is 60(seconds)*60(minutes)*24(hours).
If your startDate is not from current date then you can use this method
now you are getting like this
so you can have two dates, represents start time and end time. Use below method to get time interval
now you have two time interval for two different dates, right? Now simply subtract it and you will get what you want.