Question: Renewed question:
I have an application where the user can add a new workshop along with a workshop date. After that, he chooses from a UIDatePicker
After this, the user can edit the workshop information including editing. The following is what I am trying to do: 1. When the user adds a new workshop, read the time to select the user from UIDatePicker
. 2. Convert date to string and save it to database. 3. When the user wants to edit the workshop, I should get the workshop date from the database and change it from string to NSDate
. 4. UIDatePicker
is built in "interface" in NSDate
.
I think this sound is logical. However, this is not working for me and I'm not sure why the code is here:
In the AddWorkshop.m
class
NSDateFormatter * dateFormat = [[NSDateFormatter alloc] init]; [DateFormat setDateStyle: NSDateFormatterMediumStyle]; // WSDate a NSString variable self.WSDate = [dateFormat stringFromDate: [sender date]];
In the EditWorkshop.m
category
NSDateFormatter * df = [[NSDateFormatter alloc] init]; [DF Settte Stella: NSDAT Formamium Style]; NSDate * date1 = [df dateFromString: self.WSDate]; [Self-portrait picture set date: date 1];
The problem is:
-
UIDatePicker
will not change the date The specified date, It always shows on today's date. -
When I have the NSLOG date 1 and myself If I try WDDate, the value of date 1 is always one day low then
self.WSDate
-
[UIDTPK set date: NSDT] has a specific format for the date passed? For example: Is it ok to have "MMMM DD Yay" or "MMD-DD-YEY" or any format?