Difference between NSDate and NSDateComponent value for the same date

前端 未结 1 419
滥情空心
滥情空心 2020-12-07 06:03

I created a simple function to get first and last day of a week for a day in it. Looking at the NSLog output i found that different values are returned from a NSDate descrip

相关标签:
1条回答
  • 2020-12-07 06:39

    Your dates are being printed with a timezone of +0000 (UTC), while your NSCalendar instance (and therefore your NSDateComponents) is using your device's default timezone (which I would guess is UTC+2).

    0 讨论(0)
提交回复
热议问题