魔兽世界南音梦予,天地姻缘琉璃仙女,东莞废金属回收
一, 代码。
- (void)viewdidload { [super viewdidload]; // do any additional setup after loading the view, typically from a nib. //获得现在的时间 [self currenttime]; } #pragma -mark -functions //计算现在的时间 - (void)currenttime { //时间格式 nsdateformatter *dateformatter = [[nsdateformatter alloc] init]; [dateformatter setdateformat:@"yyyy-mm-dd hh:mm:ss"]; //现在时间 nsdate * currentdate = [nsdate date]; nsstring * currentdatestring = [dateformatter stringfromdate: currentdate]; nslog(@"---currentdatestring--%@",currentdatestring); }
二,输出。
2015-10-23 10:15:24.928 计算现在的时间[1607:61610] ---currentdatestring--2015-10-23 10:15:24
以上所述是小编给大家介绍的ios 获得现在的时间代码,希望对大家有所帮助
如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复
iOS 使用UITextField自定义搜索框 实现用户输入完之后“实时搜索”功能
网友评论