Search Results

Search found 240 results on 10 pages for 'nsdate'.

Page 3/10 | < Previous Page | 1 2 3 4 5 6 7 8 9 10  | Next Page >

  • iPhone NSDate - get time in milliseconds and store in coredata

    - by satyam
    I'm implementing iphone app with coredata functionality. I've an attribute in entity "NSDate" which stores the date and time when the record is added. I'm adding records at a faster rate. About 1 record per 25 milli seconds I want to store the date along with milli seconds so that I can retrieve the data in descending order. How can I do this?

    Read the article

  • objective c and NSDate

    - by Amir
    hello all, I am looking for component that can handle a spesific date. what i am trying to do is to get Astring fron sever that represent date(for example 04-08-2012) in my iphone i want to be able to "work" with this date. such to compare it to another date , check if the date in the past or future and to print it to the app GUI i tried work with NSDate but i didnt found how can i set a spesific date? thanks

    Read the article

  • Problem with NSDateformatter

    - by Nithin
    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 the date --- '2010-01-10 00:03:00 +0600' The month is changed to 1 and the minute to 3, What might be the problem???

    Read the article

  • Get EXEC_BAD_ACCESS when I get the NSFileModificationDate

    - by Toto
    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, it works !! NSTimeInterval lastModifDiff = [lastModif timeIntervalSinceNow];//crash here } I don't understand why the NSDate seems to be released, why the retain does not retain it. Thank you if you have any idea...

    Read the article

  • iPhone SDK - Number of days between day and today

    - by Hankweb
    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)

    Read the article

  • Retrieving NSDate from NSString

    - by Olivier de Jonge
    I have an iPhone app. that is receiving data with IRFC 3339 timestamp format (e.g. @"2010-01-29T11:30:00.000+01:00"), as in GData. I want to convert the data to an NSDate NSDateFormatter *inputFormatter = [[[NSDateFormatter alloc] init] autorelease]; [inputFormatter setDateFormat:@"yyyy-MM-dd'T'HH:mm:ss.SSS"]; [currentEntry setStartTime:[inputFormatter dateFromString: ][currentEntry startTimeString]]]; But I'm missing out how to convert the last part of the string @"2010-01-29T11:30:00.000+01:00": the time offset. Anyone knows what I have to add to this String to take the time offset in account too?

    Read the article

  • convert string to date and write back into NSMutableArray

    - by padatronic
    I have a NSMutableArray I get by loading a plist into it. The date field comes in as a string and i want to change it into a nsdate. I can change an nsstring into an nsdate. My array is an array of objects like the one below; { Date = "1/1/2009" Description = "Have you ever looked at a badger and thought i wonder how far you could fire that out of a cannon? Well this talk is for you"; File = "http://www.badgerCannon.org.uk/mp3/070310pm.mp3"; Series = "The Badger planet"; Speaker = "Will Ferell"; Title = "Is it a bird, is it a plane? no its a badger"; } I loop through and pull out the date and convert it from a NSString to a NSDate. I try writing it back in using the code; [[self.MediaDataArray objectAtIndex:i] replaceObjectAtIndex:0 withObject:Date]; but it errors and i am pretty sure it is because i am not putting it back into the array in the same format, ie just as a date not as date = "date". But lets face it i don't really know! Am i barking up the wrong tree? Please help, i have got the coding equivalent of writters block, or alternatively am just being really stupid! thanks in advance

    Read the article

  • Is this reference or code in mistake or bug?

    - by mikezang
    I copied some text from NSDate Reference as below, please check Return Value, it is said the format will be in YYYY-MM-DD HH:MM:SS ±HHMM, but I got as below in my app, so the reference is mistake? or code in mistake? Saturday, January 1, 2011 12:00:00 AM Japan Standard Time or 2011?1?1????0?00?00? ????? descriptionWithLocale: Returns a string representation of the receiver using the given locale. - (NSString *)descriptionWithLocale:(id)locale Parameters locale An NSLocale object. If you pass nil, NSDate formats the date in the same way as the description method. On Mac OS X v10.4 and earlier, this parameter was an NSDictionary object. If you pass in an NSDictionary object on Mac OS X v10.5, NSDate uses the default user locale—the same as if you passed in [NSLocale currentLocale]. Return Value A string representation of the receiver, using the given locale, or if the locale argument is nil, in the international format YYYY-MM-DD HH:MM:SS ±HHMM, where ±HHMM represents the time zone offset in hours and minutes from GMT (for example, “2001-03-24 10:45:32 +0600”)

    Read the article

  • Using core plot for iPhone, drawing date on x axis

    - by xmax
    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:(CPPlot *)plot field:(NSUInteger)fieldEnum recordIndex:(NSUInteger)index I mean how my date value will be returned as NSNumber..? I think i should use some interval over there.but what should be the exact conversion..? can any one explain me what are the exact requirement to plot the date on xAxis..? I am plotting my plot in half of the view.

    Read the article

  • NSDate compare is false?

    - by user1280535
    i compare 2 NSDates which are the same and i get false result. i cant show how i get this dates because its too long , but i can show what i do : NSLog(@"this date is:%@ , and date we check to equality is:%@",thisDate,dateToFind); if([thisDate isEqualToDate:dateToFind] ) { NSLog(@"equal date!"); // not printed! } the NSLog show me this : this date is:2012-09-13 14:23:54 +0000 , and date we check to equality is:2012-09-13 14:23:54 +0000 he doesnt print the NSLog . why ?

    Read the article

  • Comparing NSDates

    - by Garry
    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?

    Read the article

  • How to create a specific date in the distant past, the BC era.

    - by alloy
    I’m trying to create a date in the BC era, but failing pretty hard. The following returns ‘4713’ as the year, instead of ‘-4712’: NSCalendar *calendar = [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar]; NSDateComponents *components = [NSDateComponents new]; [components setYear: -4712]; NSDate *date = [calendar dateFromComponents:components]; NSLog(@"%d", [[calendar components:NSYearCalendarUnit fromDate: date] year]); Any idea what I’m doing wrong?

    Read the article

  • Format a date from a string

    - by Emil
    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 :)

    Read the article

  • Objective C: Compare timeInMillis with current time

    - by Srivathsan Canchi
    Hello, In my iPhone application, I need to calculate the time difference between the time a message was created on the server, and the time my phone received it. The server (Java) puts in a number returned by System.currentTimeMillis() as metadata along with the message. How do I compare this number with the current time on the device? Could not find a suitable NSDate method to do this comparison. Thanks in advance!

    Read the article

  • NSDateFormatter always return 2010-12-31 23:00:00 +0000

    - by Janky
    Hello! I'm using this code to format a date from a string: NSDateFormatter *dateFormat = [[NSDateFormatter alloc]init]; [dateFormat setDateFormat:@"EEEE, dd MMMM yyyy"]; NSDate *dateStart = [dateFormat dateFromString:[thisEvent dateEvent]]; [thisEvent dateEvent] contains this date: Saturday, 09 April 2011 I don't know why dateStart contains 2010-12-31 23:00:00 +0000 where I'm wrong? Thank You!!

    Read the article

  • How to format date from string?

    - by 4thSpace
    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 release line, formattedDate shows "invalid CFStringRef" and Cannot access memory at address 0x0 Any ideas what I'm doing wrong?

    Read the article

  • NULL value when using NSDateFormatter

    - by David A Gibson
    Hello, I am using the following code to try and display in a time in a table cell. TimeSlot *timeSlot = [timeSlots objectAtIndex:indexPath.row]; NSDateFormatter *timeFormat = [[NSDateFormatter alloc] init]; [timeFormat setDateFormat:@"%1m/%1d/%Y"]; NSLog(@"Time: %@", timeSlot.time); NSDate *mydate = timeSlot.time; NSLog(@"Time: %@", mydate); NSString *theTime = [timeFormat stringFromDate:mydate]; NSLog(@"Time: %@", theTime); The log output is this: 2010-04-14 10:23:54.626 MyApp[1080:207] Time: 2010-04-14T10:23:54 2010-04-14 10:23:54.627 MyApp[1080:207] Time: 2010-04-14T10:23:54 2010-04-14 10:23:54.627 MyApp[1080:207] Time: (null) I am new to developing for the iPhone and as it all compiles with no errors or warnings I am at a loss as to why I am getting NULL in the log. Is there anything wrong with this code? Thanks

    Read the article

  • how can we count the time interval of the animation in cocos2d ?

    - by srikanth rongali
    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 the time interval of the animation and time at the completion of the animation ? I am animating a sprite. Please help how can I make it. Thank You.

    Read the article

  • How can i get the correct date?

    - by Haley
    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 = NSYearCalendarUnit | NSMonthCalendarUnit | NSDayCalendarUnit; NSCalendar* calendar = [NSCalendar currentCalendar]; NSDateComponents* components = [calendar components:flags fromDate:oldDate]; int day = [components day]; When NSString *strTime = @"2010-05-14 16:00:01" the day is 15,and when NSString *strTime = @"2010-05-14 16:00:00" the day is 14.I want to know why?

    Read the article

  • Why do I get "2010-01-01 00:00:00 +900" from "2010-12-31 15:00:00 +000"?

    - by mikezang
    I have NSDate, it will be shown as below if I used NSLog(@"%@", date.description); 2010-12-31 15:00:00 +0000 it will be shown as if I used NSLog(@"%@", [date descriptionWithLocale:[[NSLocale currentLocale] localeIdentifier]]); Saturday, January 1, 2011 12:00:00 AM Japan Standard Time But it will be show as below if I used NSLog(@"%@", [date formattedDateString]); 2010-01-01 00:00:00 +0900 Where do I make mistake? (NSString *)formattedDateString { return [self formattedStringUsingFormat:@"YYYY-MM-dd HH:mm:ss ZZZ"]; } (NSString *)formattedStringUsingFormat:(NSString *)dateFormat { NSDateFormatter *formatter = [[NSDateFormatter alloc] init]; [formatter setDateFormat:dateFormat]; NSString *ret = [formatter stringFromDate:self]; [formatter release]; return ret; }

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10  | Next Page >