Hi
I have this code:
- (NSString*) tableView:(UITableView *)tableView titleForHeaderInSection:(int)section{
curDate = [NSDate date]; // Get current date
calendar = [NSCalendar currentCalendar];// Init calendar
comps = [calendar components:NSYearCalendarUnit|NSMonthCalendarUnit|NSWeekCalendarUnit|NSWeekdayCalendarUnit fromD...
Hi
In my app I have next and previous week buttons, but also a UIDatePicker. So lets say I press the net week button, how can I adjust the day in the UIDatePicker to increase by 7 days? And visa versa for back 7 days.
Thanks!
...
How can I output the current date and time with the defaulttimezone?
When I use following code I always get the time in GMT. Is it possible to convert NSDate to the defaulttimezone? I can’t use the NSDateFormatter because I need an NSDate Object with the correct time.
NSDate *date = [NSDate date];
NSLog(@"Time: %@", date);
Output: 201...
Hi all,
I am converting NSString to NSDate with help of NSDateFormatter. Now code works fine here in all OS with device & simulator but it is creating different Output at UK, USA region. Here is the code that I am using.
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setDateFormat:@"yyyy-MM-dd HH:mm:ss"...
Hello
I am parsing the following string format: "29/09/2010 12:45:00" with the following code:
NSDateFormatter *df = [[NSDateFormatter alloc] init];
[df setDateFormat:@"dd/MM/yyyy HH:mm:ss"];
NSDate *dateTime = [[df dateFromString:dateAndTime]];
But the NSDate object then contains the following: 2010/09/29 11:45:00
Does anyone have ...
I have an app which I am updating to OS4. In this I use a time picker. From this I want to get an hour and minute as an integar. This is the code I used previously for this...
NSDate *selected = [timePicker date];
NSCalendar *gregorian = [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar];
unsigned unitFlags = NSYearCal...
Hi.
I am importing a CSV file with a date format of month/day/year (e.g. 21/01/2007).
I am looping through the CSV some are working but some are coming out with the date 1 day previous with a time of 23:00? One of the dates that are not working would look like this:
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
...
Does anyone know how to get the NSDate of the coming friday's 20:00 ?
...
When I call
NSDate *now = [[NSDate alloc] init];
in order to get the current date and time, I check it with:
NSLog(@"Date now: %@", now);
the date outputted is one hour in the past.
2010-10-08 12:04:38.227
MiniBf[1326:207] Now: 2010-10-08
11:04:38 GMT
Is my time zone set incorrectly somewhere perhaps?
Thanks!
Micha...
In objective-C, I want to determine the seconds elapsed from a date string such as: "Sat, 09 Oct 2010 06:14:50 +0000"
How do I do this? I got lost in the convoluted descriptions of NSDateFormatter.
...
I currently have an API call returning me a date/time in the format: "2010-10-10T07:54:01.878926" ..Can I assume this is GMT? I also converted this to an NSDate object. Is there a way to use the local iPhone time to recalculate the time?
...
Hi friends
how to compare an adjacent array element that contains date. The thing is when
i compare
BOOL day = [[temp_date objectAtIndex:k] compare:[temp_date objectAtIndex:k+1]];
it throughs the following expection
* Terminating app due to uncaught exception 'NSRangeException', reason: '* -[NSCFArray objectAtIndex:]: index (23) be...
Hello geniuses,
I'm trying to write a simple function using Objective C that accepts an NSDate object and returns an NSDate object that contains the same date value but has removed any time components from the date.
For example if I were to pass an NSDate with a value of '2010-10-12 09:29:34' the function would return 2010-10-12 00:00:...
How would I convert an NSString like "01/02/10" (meaning 1st February 2010) into an NSDate? And how could I turn the NSDate back into a string?
...
I know the question sounds a little funny.
I am trying to move down the list of array in my iPhone project.
I have an array of 100 items:
[0][1]...[99]
I would like to select index[0] today, index[1] tomorrow... index[99] 100 days from now. And then on day 101, back to index [0].
Maybe I need to convert NSDate and get todays date in...
Hi all, I have a feeling this is due to some time zone not being set or something this is what I have:
NSDateComponents *theComponents = [calendar components:(NSYearCalendarUnit | NSMonthCalendarUnit | NSDayCalendarUnit) fromDate:workingDate];
NSLog(@"%d", theComponents.day);
[theComponents setDay:3];
NSLog(@"%d", theComponents.day);
se...
Hi guys,
I have an NSURL which contains a URL and a variable that is an NSDate:
NSURL *url = [[[NSURL alloc] initWithString:[NSString stringWithFormat:@"http://www.googlebio.com/xml_test.aspx?date=%@",self.storeDate]] autorelease];
I also tried it this way but to no avail:
NSString*string = [NSString stringWithFormat:@"http://www.go...
I am trying to do this in Xcode...
Today's Date = Day of the year
October 13th = 303 (I think)
January 1st = 1
December 31st = 365
NSDate to get todays date, then I'm out of idea =(
...
Hi.
In MyappAppDelegate.m file at "application: didFinishLaunchingWithOptions:" method, I just wrote:
NSDateFormatter *df = [[NSDateFormatter alloc] init];
[df setDateFormat:@"yyyy"];
NSDate *date = [NSDate date];
NSLog(@"%@", [df stringFromDate:date]);
return;
And ran with iPhoneSimulator, console said:
2010-10-15 20:38:43.571 M...
I'm enumerating a dictionary and checking for a known date. If the exact date (both date and time) matches my known date, I want the for loop to stop enumerating. THe issue I'm having is that during the check, I break out of the if statement instead of the for loop.
//known date has already been applied to self.knownDate
for (id objec...