set day format to dd/MM
This commit is contained in:
parent
9173315981
commit
49c425a5fe
1 changed files with 4 additions and 3 deletions
7
Tweak.xm
7
Tweak.xm
|
@ -10,11 +10,12 @@
|
|||
- (void)setText:(NSString *)text {
|
||||
if([text containsString:@":"]) {
|
||||
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
|
||||
dateFormatter.locale = [[NSLocale alloc] initWithLocaleIdentifier:@"en_US"];
|
||||
dateFormatter.dateStyle = NSDateFormatterShortStyle;
|
||||
// dateFormatter.locale = [[NSLocale alloc] initWithLocaleIdentifier:@"en_US"];
|
||||
[dateFormatter setDateFormat:@"dd/MM"];
|
||||
//dateFormatter.dateStyle = dd/MM/yyyy;
|
||||
NSDate *now = [NSDate date];
|
||||
NSString *shortDate = [dateFormatter stringFromDate:now];
|
||||
shortDate = [shortDate substringToIndex:[shortDate length]-3];
|
||||
shortDate = [shortDate substringToIndex:[shortDate length]];
|
||||
NSString *newString = [NSString stringWithFormat:@"%@\n%@", text, shortDate];
|
||||
self.numberOfLines = 2;
|
||||
self.textAlignment = 1;
|
||||
|
|
Reference in a new issue