如何将事件添加到默认日历
大家好,我需要将事件存储在默认日历中。所以我需要将给定的日期字符串转换为 Nsdate。这里我没有得到正确的格式..有什么帮助吗....我在下面给出了我的代码。 ..
我的日期字符串是 //startdate--format---November 19 2011 9:30 PM
采用这种格式..我已经这样写了
NSDateFormatter *dateformatter=[[NSDateFormatter alloc]init];
[dateformatter setDateFormat:@"MMMM dd yyyy H:m a"];
NSLog(@"start date is %@",startdate);
NSDate *dates=[[NSDate alloc]init];
dates=[dateformatter dateFromString:startdate];
NSLog(@"date is %@",dates);
,我得到了这样的输出,我需要添加它用于活动。我没有得到确切时间...日期是 2011-11-19 07:00:00 +0000
Hi every one i need to keep event to store in default calendar.so i need to convert the given date string into Nsdate.Here i am not getting correct format..could any help....and i am giving my code below...
my date string is //startdate--format---November 19 2011 9:30 PM
in this format..i have written like this
NSDateFormatter *dateformatter=[[NSDateFormatter alloc]init];
[dateformatter setDateFormat:@"MMMM dd yyyy H:m a"];
NSLog(@"start date is %@",startdate);
NSDate *dates=[[NSDate alloc]init];
dates=[dateformatter dateFromString:startdate];
NSLog(@"date is %@",dates);
and i am getting ouput like this i need to add it for event.i am not getting exact time...date is 2011-11-19 07:00:00 +0000
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
试试这个(对我来说效果很好):
如果你想设置特定时区,那么只需使用方法
setTimeZone
:Try this (that works fine for me):
If you want to set specific time zone then just use method
setTimeZone
:最后我找到了错误的解决方案。代码如下
-(IBAction)notifyButtonpressed:(id)sender
{
NSLog(@"通知按钮按下");
}
At last i Found the solution for the error .The Code is below
-(IBAction)notifyButtonpressed:(id)sender
{
NSLog(@"notify button pressed");
}