亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

iOS 獲得現(xiàn)在的時間代碼

 更新時間:2017年06月29日 10:12:54   作者:弦外雨  
本文通過實例代碼給大家介紹了iOS 獲得現(xiàn)在的時間的方法,代碼簡單易懂,非常不錯,具有參考借鑒價值,需要的的朋友參考下吧

一, 代碼。

- (void)viewDidLoad {
  [super viewDidLoad];
  // Do any additional setup after loading the view, typically from a nib.
  
  //獲得現(xiàn)在的時間
  [self currentTime];
}
#pragma -mark -functions
//計算現(xiàn)在的時間
- (void)currentTime
{
  //時間格式
  NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
  [dateFormatter setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
  //現(xiàn)在時間
  NSDate * currentdate = [NSDate date];
  NSString * currentDateString = [dateFormatter stringFromDate: currentdate];
  NSLog(@"---currentDateString--%@",currentDateString);
}

二,輸出。

2015-10-23 10:15:24.928 計算現(xiàn)在的時間[1607:61610] ---currentDateString--2015-10-23 10:15:24

以上所述是小編給大家介紹的iOS 獲得現(xiàn)在的時間代碼,希望對大家有所幫助,如果大家有任何疑問請給我留言,小編會及時回復(fù)大家的。在此也非常感謝大家對腳本之家網(wǎng)站的支持!

相關(guān)文章

最新評論