Actually in my simulater TIME displays past 5 hrs 30 mins
My current time in india is 2013-04-02 09:10:__ AM But the output is 2013-04-02 03:54:51 +0000
2013- April - 2nd : 9:10 AM
I need to get some results between two dates 1.First Date of month to 2.Current Date of any day
ie from April 1st to April 2nd 9.10 AM t0 current time 2013-04-02 09:10:__ AM
but it dispalys
Date of first day of month as 2013-03-31 18:30:00 +0000
Current Time as 2013-04-02 03:54 :51 +0000 but the actual time is 09:10:__ AM
I compute first date of the month as follows
// TO IMPLEMENT CODE for FIRST DAY OF the Month
NSCalendar* calendar = [NSCalendar currentCalendar];
NSDateComponents* comps = [calendar components:NSYearForWeekOfYearCalendarUnit |NSYearCalendarUnit|NSMonthCalendarUnit|NSWeekCalendarUnit|NSWeekdayCalendarUnit fromDate:[NSDate date]];
calendar.timeZone = [NSTimeZone systemTimeZone];
[comps setWeekday:1]; // 1: sunday
monthComponent = comps.month;
yearComponent = comps.year;
dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setDateFormat:@"yyyy MM dd"];
dateFormatter.timeZone = [NSTimeZone systemTimeZone];
// To get the firstDateOfMonth for This MONTH.
NSDate *firstDateOfMonth = [dateFormatter dateFromString:[NSString stringWithFormat:@"%d %d 01",yearComponent,monthComponent]];
NSLog(@"firstDateOfMonth-- %@ \r\n",firstDateOfMonth);
NSLog(@"[NSDate date]-- %@",[NSDate date]);
I set timezone SystemTimeZone even thought i got wrong results for Current date and firstDateOfMonth
Thanks in advance