ロングロングタイプとは?それは8バイトかかる整数ですよね?次のようにlonglong型をNSStringに変換したいと思います。
long long fbid = [[friend objectForKey:@"id"]longLongValue];
変数fbid
にの値が必要です。NSString *str
私に何ができる?
NSString *str = [NSString stringWithFormat:@"%lld", fbid];
たぶん、あなたはこのファイルを参照としてあなたと一緒に保管したいと思うかもしれません、私はそれを画像として見栄えよくしました:
NSString *str = [NSString stringWithFormat:@"%qi",fbid];
NSString *str =[[NSNumber numberWithLong:fbid] stringValue];
次のコードは、1970年1月1日からのミリ秒数を返します。
- (NSString *) timeInMiliSeconds
{
NSDate *date = [NSDate date]; // Current Date
NSString * timeInMiliseconds = [NSString stringWithFormat:@"%lld", [@(floor([date timeIntervalSince1970] * 1000)) longLongValue]]; // Returns you number of milliseconf
return timeInMiliseconds;
}
秒の場合:[@(floor([date timeIntervalSince1970]))]