Quote:
Originally Posted by iOS.Lover
thanks , I am using this code to show the date , :
Code:
- (NSString *) showPersianFullDate {
NSCalendar *calendar = [NSCalendar currentCalendar];
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
NSLocale *locale = [NSLocale currentLocale];
[dateFormatter locale];
[dateFormatter calendar];
//ADDING DAY
offsetComponents = [[NSDateComponents alloc] init];
offsetComponents.day = _dayNumber;
NSDate *nextDate = [calendar dateByAddingComponents: offsetComponents toDate:[NSDate date] options:0];
[dateFormatter setDateFormat:@"EEEE ، d MMMM"];
NSString *currDay = [dateFormatter stringFromDate:nextDate];
[NSString stringWithFormat:@"%@",currDay];
[calendar release];
[dateFormatter release];
return currDay;
}
But I don't know how can connect this date to saving process
|
You're cutting and pasting bits of code almost at random, without any real idea what you're doing. You have quite a few statements in that function that do absolutely nothing:
These two lines return the value of properties of the date formatter that you create, which you ignore.
Code:
[dateFormatter locale];
[dateFormatter calendar];
You create a variable offsetComponents, and set it up to hold a value _dayNumber, for no apparent reason:
Code:
//ADDING DAY
offsetComponents = [[NSDateComponents alloc] init];
offsetComponents.day = _dayNumber;
You add offsetComponents to your date, again for no apparent reason.
This line does absolutely nothing:
Code:
[NSString stringWithFormat:@"%@",currDay];
The code you've posted is such a confused muddle that I can't even tell what you are trying to do.
Explain to me in words what you want to do with dates.