NSDateComponents issue - incorrect day

后端 未结 3 969
我在风中等你
我在风中等你 2021-01-19 14:34

I have a NSDateComponents problem. I have two NSDates that I am trying to compare by checking if their year, month and day match. This I am doing by converting the NSDate va

3条回答
  •  天涯浪人
    2021-01-19 15:37

    It looks like you have a time zone issue. Though your dates are set at time zone +0000, your [NSCalendar calendar] call likely returns you a calendar for your local time zone. Given the adjustment to local time, the orderDate is likely in the next day. Manually set your calendars to time zone +0000.

提交回复
热议问题