吵架后先道歉的人不是因?yàn)殄e(cuò),而是因?yàn)檎湎?
時(shí)間戳是在簽名中扮演著重要的角色,我們可以我們可以使用時(shí)間戳讓我們的簽名時(shí)刻發(fā)生改變,以前工作中都是只是把代碼謝了一遍又一遍,為了降低代碼的重復(fù)率,所以我把時(shí)間轉(zhuǎn)化為時(shí)間戳和時(shí)間戳轉(zhuǎn)化為時(shí)間謝了兩個(gè)方法,以后,直接來(lái)這里CV就好
-
當(dāng)前時(shí)間轉(zhuǎn)化為時(shí)間戳
-(NSString *)transformWithNowTime{
NSDate *datenow = [NSDate date];//現(xiàn)在時(shí)間,你可以輸出來(lái)看下是什么格式
NSString *timeSp = [NSString stringWithFormat:@"%ld", (long)[datenow timeIntervalSince1970]];
return timeSp;
}
-
時(shí)間戳轉(zhuǎn)化為時(shí)間
-(NSString *)transformWithDatatime:(NSInteger)datatime{
NSDateFormatter *formatter = [[NSDateFormatter alloc] init] ;
formatter.dateFormat = @"yyyy-MM-dd";
NSDate *confromTimesp = [NSDate dateWithTimeIntervalSince1970:datatime/1000];
NSString *confromTimespStr = [formatter stringFromDate:confromTimesp];
return confromTimespStr;
}
這里講的只是一個(gè)時(shí)間戳和時(shí)間的相互轉(zhuǎn)化,對(duì)于簽名,我會(huì)寫一篇文章,講講如何關(guān)于簽名的相關(guān)的.