开发者

How to format date to Fri-05 Aug

I have followed the Apple documentation and I am having no success:

- (NS开发者_StackOverflow中文版String *)formatDepartureDateForColumn:(NSDate *)departureDate
{
    NSString *result;
    NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];

    [dateFormatter setDateFormat: @"%a-%d %b"]; 
    result = [dateFormatter stringFromDate: departureDate];

    [dateFormatter release];
    return result;

}

Anyone have any ideas? I want the date formatted like this Fri-05 Aug


The documentation you refer to is for OS X 10.3 and earlier. Try:

[dateFormatter setDateFormat:@"E-dd MMM"]

See Date Formatters for OS X and iOS. Since 10.4 unicode formats have been used.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜