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"]; strDa...
How can I check if an NSDate is a specific day of the week, like a Monday, Tuesday, Wednesday, and so on?
...
I'm using addTimeInterval for creating local notification but it seems that it is now deprecated (iOS 4).
My code:
localNotif.fireDate = [now addTimeInterval:timeInterval];
Xcode's warning:
'addTimeInterval:' is deprecated (declared at /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.0.sdk/System/Library/Frameworks/Fo...
Hello,
I'm creating a date like this :
NSCalendar *gregorian = [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar];
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setDateFormat:@"YYYY"];
NSInteger year = [[dateFormatter stringFromDate:[NSDate date]] intValue];
NSLog(@"NSInteger YEAR : %...
If I have a UIDatePicker, and I wish to set the minimum and maximum date range to be between thirty years ago and thirty years in the future, how would I set that up?
...
I'm writing a GTD app for the iPhone. For the due tasks, I want to display something like "Due tomorrow" or "Due yesterday" or "Due July 18th". Obviously, I need to display "Tomorrow" even if the task is less than 24 hours away (e.g. the user checks at 11pm on Saturday and sees there's a task on Sunday at 8am). So, I wrote a method to ge...
How can I compare two NSDates and return the amount of time between them.
For example:
2010-06-20 14:29:41 -0400
2010-06-20 14:53:29 -0400
should return something like: 23 or 24(minutes), rounding the seconds because I don't really need the seconds.
...
Hello,
is there a way to convert strtotime-like Strings (e.g.: '-3 days' with a given date) with NSDate?
...
Hey everybody,
My question is the REVERSE of the typical "How do I find out if an NSDate is between startDate and endDate?"
What I want to do is find ALL NSDATES (to the day, not hour or minute) that occur BETWEEN startDate and endDate. Inclusive of those dates would be preferable, although not necessary.
Example:
(I know that these d...
Is it possible to see on a NSDate whether the time part has been set or not?
Or to rephrase the question: is it possible to create a NSDate in such a way that when I look at the instance I can see whether the time was set or not?
I am having an issue where I read sometimes DATE and sometimes DATETIME from a database. In both cases I c...
I'm trying to figure out how to calculate store opening times based on the way they are normally expressed. For example: Monday - Friday, 9am - 6pm. I want to know two things from this criteria. Is the store open? If it is how long will it be before it closes?
My confusion with the documentation is that NSDate calculations expect uniqu...
My app hit the app store today. I had a user submit a weird bug. I have a date picker that passes back a date that I store as a string in SQLite. I tested the app on the simulator, a 3G, a itouch, and an iPAD. On all of these, it works as expected. However, on this user's 3GS it adds a day to the date selected in the date picker.
I...
I have a string in the format "Fri Jul 09 17:57:44 +0000 2010" which I need to convert to an NSDate.
I have tried a few unsuccessful operations to convert this date, and was wondering if anyone could tell me how I can achieve this.
Regards
...
How can I parse this into an objective-c object most efficiently?
"2010-07-13T11:22:33-07:00"
This is what I tried
NSDateFormatter *format = [[NSDateFormatter alloc] init];
[format setDateFormat:@"yyyy-MMM-ddTHH:mm:ssZ"];
...
How can I parse this into an objective-c NSDate most efficiently?
"2010-07-13T11:22:33-07:00"
This is what I tried
NSDateFormatter *format = [[NSDateFormatter alloc] init];
[format setDateFormat:@"yyyy-MMM-dd'T'HH:mm:ssZ"];
but did not work
...
I am trying to define the equivalent of DateTime.MaxValue (C#) but in Objective C.
I don't want to keep creating NSDates every time I use it so I wish I had it as const.
The problem, the compiler returns "Initializer element is not constant"
Here is the code
static NSDate* DateTimeMinValue = [NSDateFormatter dateFromString:@"00:00:0...
I have a view containing a segmented controller and a UIDatePicker that only shows 24-h time. I want to be able to set different times depending on what the segmented control says. So "Mon" would correspond to one time, "Tue" to another and so on. I have this working. However, I also would like to animate the picker when the user changes...
All i am trying to do, is to get an NSString with the value of the current date ( NOW )
with this format:
7/14/10 8:20 PM
Exactly like the native mail app of the iPhone.
i am using the following code to do it:
NSDateFormatter *dateFormat = [[NSDateFormatter alloc] init];
[dateFormat setDateFormat:@"EEE, dd MMMM yyyy HH:mm:ss ...
I have implemented a simple clock like so:
- (void)runTimer {
timer = [NSTimer scheduledTimerWithTimeInterval:1.0
target:self
selector:@selector(showActivity)
userInfo:nil
...
I've not found a answer to this question anywhere, but this seems like a typical problem: I have in Objective-C a "NSDate timestamp" that looks like "2010-07-14 16:30:41 +0200". The java timestamp is just a long integer (for example:"976712400000").
So, my question is: What is a Objective-c equivalent to java timestamp?
Thanks in adva...