iPhone shortdate с 4 годами цифры

Shape может быть установлен на символ Unicode. Ниже приведены череп и скрещенные кости, но вы можете найти более подходящий символ.

Обратите внимание, что окончательный результат будет зависеть от шрифта, использованного для создания графика.

ggplot(data = df, aes(x =x, y=y)) +  
  geom_point(shape="\u2620", size = 10) 

7
задан Dave 10 May 2009 в 15:12
поделиться

2 ответа

If you need four digit years, set the dateformat: using the exact format you'd like. The downside is you lose automatic locale formatting.

NSDateFormatter *dateFormatter = [[[NSDateFormatter alloc] init] autorelease];
[dateFormatter setDateFormat:@"MM/dd/yyyy"];

...

birthday.text = [dateFormatter stringFromDate:p.Birth];

If you need localization then you could try modifying the date format of the short style.

NSDateFormatter *dateFormatter = [[[NSDateFormatter alloc] init] autorelease ];
[dateFormatter setDateStyle:NSDateFormatterShortStyle];
[dateFormatter setTimeStyle:NSDateFormatterNoStyle];

if ([[dateFormatter dateFormat] rangeOfString:@"yyyy"].location == NSNotFound) { 
    NSString *fourDigitYearFormat = [[dateFormatter dateFormat] stringByReplacingOccurrencesOfString:@"yy" withString:@"yyyy"]; 
    [dateFormatter setDateFormat:fourDigitYearFormat];             
}

Updated with Bugfix from Max Macleod

10
ответ дан 6 December 2019 в 08:17
поделиться

kCFDateFormatterShortStyle Specifies a short style, typically numeric only, such as “11/23/37” or “3:30pm”.

Available in Mac OS X v10.3 and later.

Declared in CFDateFormatter.h.

Source

NSDateFormatterShortStyle doesn't appear to give you 4 digit years.

0
ответ дан 6 December 2019 в 08:17
поделиться
Другие вопросы по тегам:

Похожие вопросы: