For those familiar with Excel, I'm trying to use a similiar NETWORKDAYS function within Cocoa.
Can anyone help with the type of info I'll need to construct an NSDate catagory that can give me only the working days betweek two dates?
many thanks
Nik
...
Hi,
What would be the best way to see if an NSDate is actually set to a date or is empty? Returning its description or changing it to string returns "(null)"...?
Thanks.
...
I think the solution is really simple, I just haven't come across it online.
Suppose I am given int year, int month, int day, int hour, int min, int sec.. how do I generate NSDate out of it?
I know we can use [NSDate initWithString:] but I think it gets complicated if month/day/hour/min/sec are one digit numbers.
...
I know that I can figure out today's date by [NSDate date]; but how would I find out today day of the week, like Saturday, Friday etc.
I know that %w can be used in NSDateFormatter, but I don't know to use it.
...
I am getting some open/closed times as integers since midnight. For example:
"1140" = 19:00 (or 7 pm if you will) or;
"570" = 9:30 (or 9.30 am)
I can easily get the time in European format, just by doing doing a simple calculation and formatting:
[NSString stringWithFormat:@"%d:00", (T / 60)]
However, this doesn't work for half hou...
I know how to use NSTimeZone to derive the offset for the current time in another time zone. NSDate always returns relative to GMT, so how do I derive a string with the proper time zone information? i.e. I take the current time where I am (in EST) and using NSTimeZone end up subtracting the 3 hours necessary to represent the time in PST....
I have a string that is UTC and would like to convert it to an NSDate.
static NSDateFormatter* _twitter_dateFormatter;
[_twitter_dateFormatter setFormatterBehavior:NSDateFormatterBehaviorDefault];
[_twitter_dateFormatter setDateFormat:@"EEE MMM dd HH:mm:ss ZZZ yyyy"];
[_twitter_dateFormatter setLocale:_en_us_locale];
NSDate *d = [_twi...
Hi everyone,
I try to get the last modification date of a file:
NSFileManager *fm = [[NSFileManager alloc] init];
NSError *err;
NSDate *lastModif = [[fm attributesOfItemAtPath:filename error:&err] objectForKey:NSFileModificationDate];//filename is ok ;-)
if(err == nil) {
[lastModif retain];
//I can put a NSLog of lastModif here...
Hi all, i've seen many questions on NSDateformatter and NSDate, but none could help me out.
[formatter setDateFormat:@"yyyy/mm/dd"];
NSDate *date = [formatter dateFromString:@"2010/03/10"];
if (date) {
NSLog(@"Date returned:::%@",date);
return date;
}
The Probelm is that, its returning t...
I'm new to the iPhone and objective-c and I am still trying to get my head around ownership of objects so bear with me.
I have a DOBViewController that has a datepicker on it. I have created a custom init method:
-(id)initWithInitialDate(NSDate *)initialDate;
Another view controller has a date instance declared (NSDate *dob) that hol...
Hi
I parse some values from an xml file.
There is a @"25-12-2010'T'23:40:00"string with the time and date and there is a string with the GMT offset like this @"+0200".
So the above time is the 25. of December 23:40:00 in timeZone +0200 GMT. (or 21:40 UTC)
I have lots of these dates with different GMT offsets. I have to display these dat...
Hi all,
I am new to the whole iPhone SDK and objective C, but have managed to get three times, two pulled from RSS feed, and one from the iphone.
I currently have: sunrise, sunset and current time set like:
6:51 am //Sunrise
7:36 pm //Sunset
11:34 AM //Current time
I am trying to work out the best approach to find out if ...
HELLO i am trying to insert Current date in my database table
i have a column dateVisited of type datetime
NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
[formatter setDateFormat:@"yyyy/MM/dd HH:mm:ss"]; //this is the sqlite's format
NSDate *stringTime = [NSDate date];
NSString *formattedDateStringTime = [formatter string...
When I look at an NSDate value in the debugger, I get something like this:
1.4.2010 22:01:47 +0100
I don't get it what this +0100 is good for. Sometimes it is +0200. Is that supposed to be the time zone or something like that? What's it exactly? How does it affect the "since reference date" value?
...
While working with NSDate, sometimes the time zones are different. But I don't mess around with locales or time zone settings at all.
i.e. sometimes (in the same process) an NSDate object may look like
1.4.2010 22:01:47 +0100
and sometimes like
1.4.2010 22:01:47 +0200
without me doing anything. What triggers the change in time z...
Hi,
I am doing my program in cocos2d.
I am using NSDate to get the current time of the start of animation. And I know my animation takes 3 seconds. So I can get the time at completion of animation by using NSInterval and using the previous time and animation time. But, if If the animation time interval is not fixed how can I calculate t...
Im trying to use Date Formatters (NSDateFormatter), but I keep getting this error:
Program received signal: “EXC_BAD_ACCESS”.
Data Formatters temporarily unavailable, will re-try after a 'continue'. (Unknown error loading shared library "/Developer/usr/lib/libXcodeDebuggerSupport.dylib")
...
Hi,
I have an NSDate object called 'dueDate'. I'm trying to work out how to display if the due date was yesterday or is tomorrow. How would I go about this?
...
Seems like a simple thing but I can't seem to find a way to do it.
It would be great to see a couple different methods.
Thanks,
Nick
...
I have the following code in a production application which calculates a GMT date from the date the user enters:
NSDate *localDate = pickedDate;
NSTimeInterval timeZoneOffset = [[NSTimeZone defaultTimeZone] secondsFromGMT]; // You could also use the systemTimeZone method
NSTimeInterval gmtTimeInterval = [localDate timeIntervalSi...