To work with Android, you must obtain the unit of milliseconds in the timestamp:
Method:
UInt64 recordTime = [[NSDate date] timeIntervalSince1970] * 1000;
First, [[NSDate date] timeIntervalSince1970] can get the following millisecond microseconds, but is omitted during storage. If a timestamp is not omitted, It is 1395399556.862046, if this parameter is omitted, the error 1395399556 is displayed. Therefore, we want to use the acquired timestamp * 1000 in milliseconds and the acquired timestamp * 1000*1000 in microseconds.
If you want to format the output, you can:
NSDateFormatter * formatter = [[NSDateFormatter alloc] init]; [formatter setDateFormat: @ "YYYY-MM-dd hh: mm: ss: SSS"]; NSString * date = [formatter stringFromDate: [NSDate date]; NSString * timeLocal = [[NSString alloc] initWithFormat: @ "% @", date]; NSLog (@ "% @", timeLocal );