what efficient way obtain nsdate object represents midnight of current day?
try this:
nsdate *const date = nsdate.date; nscalendar *const calendar = nscalendar.currentcalendar; nscalendarunit const preservedcomponents = (nscalendarunityear | nscalendarunitmonth | nscalendarunitday); nsdatecomponents *const components = [calendar components:preservedcomponents fromdate:date]; nsdate *const normalizeddate = [calendar datefromcomponents:components];
Comments
Post a Comment