I have a string with this value:
2010-05-13 23:17:29
I'd like to format it and am using the following code:
NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
formatter.dateStyle = NSDateFormatterMediumStyle;
NSDate *formattedDate = [formatter dateFromString:dateString];
[formatter release];
When the debugger reaches the ...
Hi,
I have a time of NSString type. i wonder get the day, but i find somethine strange.
NSString *strTime = @"2010-05-14 16:00:01";
NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
[formatter setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
NSDate *oldDate = [formatter dateFromString:strTime];
unsigned int flags = NSYearCal...
//NSString *compileDate = [NSString stringWithFormat:@"%s", __DATE__];
NSString *compileDate = [NSString stringWithUTF8String:__DATE__];
NSDateFormatter *df = [[[NSDateFormatter alloc] init] autorelease];
[df setDateFormat:@"MMM d yyyy"];
//[df setDateFormat:@"MMM dd yyyy"];
NSDate *aDate = [df dateFromString:compileDate];
...
Hello
I want to create a function which results the date of next Friday but i've no plan how to do it. Has anyone a good hint to me ?
Greets Simon
...
Hi
Well I guess this has been asked a thousand times, but for some reason the answeres dont really work or had other problems,....
Anyway here is what I have "working" :
NSCalendar *calendar = [NSCalendar currentCalendar];
NSDate *currentDate = [NSDate date];
NSDateComponents *comps = [[NSDateComponents alloc] init];
...
I have an NSDate object and need an integer of the day. i.e. if we have 25th May 2010, the int should be 25. Is there a simple way to do it?
...
Hi all!
I am newbie of objective-c and i got this crazy problem…
for low precision test case:
dateString = @"2010-05-25 11:05:21", conversion success.
dateString = @"2010-03-01 15:54:36", conversion fail.
for high precision test case:
dateString = @"2010-05-25 11:05:21.937113", conversion success.
dateString = @"2010...
I have NSDate object and I need to find from a NSArray (that has nsdate objects) all objects that have the same month and year.
...
Hi in my application i need to get the hour and minute seperately,
NSString *currentHour=[string1 substringWithRange: NSMakeRange(0,2)];
int currentHourInNumber=[currentHour intValue];
consider string1 contains "11:59:13 AM" which is coming from datepicker.
here if i use above code, its okay to get hour if its greaterthan 9. e...
Hi,
I am developing an application in that i have used DatePicker to pick the date but it gives me date with time .I have converted that format into string, now i just want date from that. How should i do that.Plz suggest me something.
Following is my code Snippet.
NSDate *selected =[datePicker date];
NSString *dateString = [NSSt...
Hi I am having two date as string , that is assigned to two labels,
one label holds current date string, that is may 29, 2010
similarly the other date will be selected by user in this same format, i need to check the user date is present, past , or future. by comparing with current date string.
please provide some sample code.
Thanks...
Hey.
I'm trying to format a date from a string into another format.
For example: 2012-05-29 23:55:52 into 29/05 *newline* 2010.
I just don't get the logics behind NSDate and NSDateFormatter, I think..
Any help will be appreciated. Thanks :)
...
I need help on how to find out how many days it has been (seven day weeks, MSTimezone) since May 6th, 2009
[NSDate *m62009 = [NSDate dateWithTimeIntervalSinceReferenceDate:231638400];
[m62009 setTimeZone:[NSTimeZone timeZoneWithAbbreviation:@"MST"]; (to help you - 231638400 seconds from 1/1/2001)
Edit:
And then how can I convert the ...
im developing Alarm Clock
i want to compare a time now and setTime is it possible to compare in minute only.
My Problem is NSDate will compare in second example 9:38:50 are not equal 9:38:00
how can i compare in minute ? is it possible
thanks you for all advise.
...
Is there any method provided by Apple or any technique that can convert a time_t type variable to an NSDate object?
...
In my ViewController I am using UIButton which triggers some action when touchedUpInside. Upto here no problem, but i also want to add another action for touchDown event. More precisely i dont have an idea how to add that action to which event, that will work the same as when App-Icon is pressed longer in springboard which causes springb...
hi i am having 2:01:20 PM format in one label,
after some calculations , i need to change the hour, minute , of that label
that is ,
is it possible to change that label value,by converting it as NSDate object and can modify hour , minute like 3:20:30 PM
is there any setter methods to do it.
Thanks in advance.
...
Hi all,
How to convert an NSDate into Unix timestamp? I've read many posts which do the reverse. But I'm not finding anything related to my question.
Thanx in advance.
...
I wish to plot a line graph where the x-axis is defined as a number of days between two dates and the y-axis is a value that varies on each of the days.
I can plot the y values as an NSNumber but I have no idea how to set the ranges and the markup on the x-axis. I have looked at the date example in the "examples" directory of the core-p...
I have available an array of dictionary that contains NSDate and NSNumber values. I wanted to plot date on X axis.
for plotting I need to supply xRanges to plot with some decimal values.I don't understand how can i supply NSdate values to xRange (low and length).
And what should be there in this method:
-(NSNumber *)numberForPlot:(CPP...