我对此很困惑。
我想获取当前时间,而不是根据条件,将所需时间添加到当前时间。
例如。
current time = 06:47:10
//or should i hv to change this format to "2011-03-26 06:47:10 GMT"
if(a= 1 and b= min )
{ //add 1 min to
current time
}
else if(a= 1 and b= hour)
{ //add 1
hour to current time
}
else if(a= 1 and b=week )
{ //add 1
week to current time
}
只需将上述条件的输出添加到当前时间即可。
请用这个指导我。
问候
最佳答案
您是说现在的时间吗?
如果是这样,它将为您做到:
NSDate *now = [NSDate date]; // Grab current time
NSDate *newDate = [now addTimeInterval:XXX] // Add XXX seconds to *now
其中XXX是时间(以秒为单位)。
关于iphone - 如何在当前时间增加时间,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/5440837/