I'm not sure if this is the best way to do this... but... I need to get the date/time since:
Midnight at the start of today
Midnight at the start of the current week (Sunday)
Midnight at the start of the current month
Midnight at the start of the current year
I use the NSDateFormatter:
[df setDateFormat:@"yyyy-MM-dd 00:00:00"]; strDate = [df stringFromDate:today];
[df setDateFormat:@"yyyy-MM-dd 00:00:00"]; strDate = [df stringFromDate:today]; // Sunday???
[df setDateFormat:@"yyyy-MM-01 00:00:00"]; strDate = [df stringFromDate:today];
[df setDateFormat:@"yyyy-01-01 00:00:00"]; strDate = [df stringFromDate:today];
They all seem to work EXCEPT "start of the current week (Sunday)".
How would I get that date? (Or is there a better way to do all of this?)
Thanks for everyone's help.