I need to create an NSDate
of the current date (or on any NSDate) without the hours, minutes and seconds and keep it as an NSDate
, in as few lines of as possible?
I need to perform some calculations on dates and having hours, minutes and seconds cause problems, I need absolute dates (I hope absolute is the right phrase). Its for an iPhone app.
I'm creating dates with [NSDate date]
which add hours, minutes and seconds. Also I'm adding months to dates which I think caters for day light savings as I get 2300 hours on some dates.
So ideally I need a function to create absolute NSDates from NSDates.
I know I asked a similar question earlier, but I need to end up with NSDate not a string and I'm a little concerned about specifying a date format e.g. yyyy etc.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…