Subscribe ( )

iPhone Programming Tutorials


 

Forum

You must be logged in to post Login Register

Search 

DateFormatter is not working on iPhone

User Post

8:54 am
December 12, 2008


sunil

Noob

India (Bangalore)

posts 5

1

Hi Guyes,

I am using below mentioned code to get the Lacale date format, it is wokring on Mac machine but not on iPhone.

    [NSDateFormatter setDefaultFormatterBehavior:NSDateFormatterBehavior10_4];
    NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
    [dateFormatter setDateStyle:NSDateFormatterShortStyle];
    [dateFormatter setTimeStyle:NSDateFormatterNoStyle];
   
    NSDateFormatter *inputFormatter = [[NSDateFormatter alloc] init];
   
    [inputFormatter setDateFormat:@"yyyy-MM-dd"];
    NSDate *date = [inputFormatter dateFromString:@"2008-12-13"];
    NSString *formattedDateString = [dateFormatter stringFromDate:date];
    NSLog(@”formatttedDateString=====%@=*****========%@ \n”, [[dateFormatter locale] localeIdentifier],formattedDateString);

Please help what is problem?

Thanks in advance.

Sunil


Search 

About the iCodeBlog forum

Most Users Ever Online:

44


Currently Online:

6 Guests

Forum Stats:

Groups: 2

Forums: 6

Topics: 419

Posts: 893

Membership:

There are 934 Members

There has been 1 Guest

There are 2 Admins

There is 1 Moderator

Top Posters:

bobcubsfan – 54

crazyiez – 30

Uhu – 17

AdeC – 17

Nick – 15

jitesh61 – 12

Administrators: Brandon (88 Posts), Collin (0 Posts)

Moderators: VertigoSol (26 Posts)



©   

  • Posted by on 6 Aug 2008 in Uncategorized
  •   |  
  •   |  
  •   |  
  • Comments Off

Comments are closed.