Calculate time interval to 0.00 of the next day according to GMT in swift or objective-c?
问题 I tried something like this: var calendar = Calendar.current var dayFutureComponents = DateComponents() dayFutureComponents.day = 1 // aka 1 day var d = calendar.date(byAdding: dayFutureComponents, to: Date()) ...//setting of d.hour, d.minute, d.second to zero and finding the difference between 2 dates The problem is for example my current GMT is +3 . So the result differs from one I need to achieve by 3 hours. How to fix this issue? 回答1: First create a Calendar for the UTC timezone. Second