set day format to dd/MM

This commit is contained in:
MPG13 (Micah Gomez) 2018-05-06 15:12:03 -06:00 committed by GitHub
parent 9173315981
commit 49c425a5fe
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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;