将 NSString 与星期几和 NSDate 与时间组合成 NSDate 对象
我有以下两个对象: 一个带有星期几的 NSString 对象,即星期一、星期二、星期三等。 使用 UIDatePickerModeTime 从 UIDatePicker 保存的 NSDate 对象。
我需要创建第三个对象 NSDate,它是 NSString 的下一次出现以及 NSDate 中的时间。
//Ex. Tuesday
NSString *confessOn = [[NSUserDefaults standardUserDefaults] objectForKey:kRemindToConfessOn];
//Ex. 2011-02-11 20:13:19
NSDate *confessAt = [[NSUserDefaults standardUserDefaults] objectForKey:kRemindToConfessAt];
NSDate *fireDate = //should be an NSDate with the value 2011-02-15 20:13:19
I have the following two objects:
An NSString object with a day of the week, ie Monday, Tuesday, Wednesday, etc.
An NSDate object that was saved from a UIDatePicker with UIDatePickerModeTime.
I need to create a third object, NSDate that is the next occurance of the NSString with the time from the NSDate.
//Ex. Tuesday
NSString *confessOn = [[NSUserDefaults standardUserDefaults] objectForKey:kRemindToConfessOn];
//Ex. 2011-02-11 20:13:19
NSDate *confessAt = [[NSUserDefaults standardUserDefaults] objectForKey:kRemindToConfessAt];
NSDate *fireDate = //should be an NSDate with the value 2011-02-15 20:13:19
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)