Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

mikezang

macrumors 6502a
Original poster
May 22, 2010
924
36
Tokyo, Japan
I tested Apple's DateCell sample, it shows as left below, then I modified code so it shows like at right.
I want to let Date Picker View also shows in "yyyy/MM/dd" format, what can I do?
Code:
- (void)viewDidLoad
{
    self.dataArray = [NSArray arrayWithObjects:@"Start Date", @"End Date", nil];
	
    self.dateFormatter = [[[NSDateFormatter alloc] init] autorelease];
    [self.dateFormatter setDateStyle:NSDateFormatterShortStyle];
    [self.dateFormatter setTimeStyle:NSDateFormatterNoStyle];
    [self.dateFormatter setDateFormat:@"yyyy/MM/dd"];
}
 

Attachments

  • SnapShot 2010-10-16 at 21.11.41.jpg
    SnapShot 2010-10-16 at 21.11.41.jpg
    72.3 KB · Views: 886
  • SnapShot 2010-10-16 at 21.09.33.jpg
    SnapShot 2010-10-16 at 21.09.33.jpg
    72.1 KB · Views: 596
I believe the picker uses the correct format for the locale set on the phone. For example my phone is set to UK locale and I get day-month-year in date pickers. To the best of my knowledge you cannot change this: the user expects the picker behaviour to be consistent.
 
I believe the picker uses the correct format for the locale set on the phone. For example my phone is set to UK locale and I get day-month-year in date pickers. To the best of my knowledge you cannot change this: the user expects the picker behaviour to be consistent.
I am in Japan, do you know why it doesn't show in Japanese format with 'yyyy/MM/dd', but in US format with 'mmm dd yyyy'?
 
I am in Japan, do you know why it doesn't show in Japanese format with 'yyyy/MM/dd', but in US format with 'mmm dd yyyy'?

What is your Region Format using in General->International? What does the Calendar app show if you create a new All Day event?
 
I am sorry, what General? Xcode or Mac OS X?

None of the above. Settings->General makes perfect sense on an iOS device so the context should have been clear. If you are running in the Simulator then it also has a Settings app with a General section. On my system even though my Mac is set to UK in Settings->General in the simulator it says United States. I would expect a competent developer to check these things themselves...
 
None of the above. Settings->General makes perfect sense on an iOS device so the context should have been clear. If you are running in the Simulator then it also has a Settings app with a General section. On my system even though my Mac is set to UK in Settings->General in the simulator it says United States. I would expect a competent developer to check these things themselves...
Thank you very much! I got what I need.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.