i have nsdate variable , change time (date shouldn't changed). possible ?
eg: user pick date interval in datepicker date (if it's start date set time 00:00:00, if it's end date, set time 23:59:59)
thanks help.
regards, alex.
you'll want use nsdatecomponents.
nsdate *olddate = datepicker.date; // or it. unsigned unitflags = nscalendarunityear | nscalendarunitmonth | nscalendarunitday; nscalendar *calendar = [nscalendar currentcalendar]; nsdatecomponents *comps = [calendar components:unitflags fromdate:olddate]; comps.hour = 23; comps.minute = 59; comps.second = 59; nsdate *newdate = [calendar datefromcomponents:comps];
Comments
Post a Comment