KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
Alright. The problem we're having is that we have NSStrings filled with dates in the format of yyyyMMdd and what we want to do is to get the current weekday and name of month. The function dagOmvandlare converts the datestring to weekday and month. The function is then called on viewDidload to name all our button-titles from english to swedish months. our current solution is looking like this: -(NSString *)dagOmvandlare:(id) suprDatum{ NSDateFormatter *dateFormatter = [[[NSDateFormatter alloc] init] autorelease]; dateFormatter.dateFormat = @"yyyyMMdd"; NSDate *date = [dateFormatter dateFromString:suprDatum]; NSString * monthString = [date descriptionWithCalendarFormat:@"%B"timeZone:nil locale:[[NSUserDefaults standardUserDefaults] dictionaryRepresentation]]; if ([monthString isEqualToString:@"January"]) { monthString = @"Januari"; } else if ([monthString isEqualToString:@"February"]) { monthString = @"Februari"; } else if ([monthString isEqualToString:@"May"]) { monthString = @"Maj"; } else if ([monthString isEqualToString:@"June"]) { monthString = @"Juni"; } else if ([monthString isEqualToString:@"July"]) { monthString = @"Juli"; } else if ([monthString isEqualToString:@"August"]) { monthString = @"Augusti"; } else if ([monthString isEqualToString:@"October"]) { monthString = @"Oktober"; } else if ([monthString isEqualToString:@"March"]) { monthString = @"Mars"
Tags (comma-separated)
Save Edits
Cancel