![](/img/trans.png)
[英]How can i get a NSDate from this string, and this NSDate to long or NSTimeInterval
[英]How I can get the NSDate of yesterday
我怎么能在iOS上獲得昨天的NSDate?
謝謝
這是一種方法:
NSDateComponents *components = [[[NSDateComponents alloc] init] autorelease];
[components setDay:-1];
NSDate *yesterday = [[NSCalendar currentCalendar] dateByAddingComponents:components toDate:[NSDate date] options:0];
請查看日期和時間編程指南 。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.