Convert an NSDate to a Unix timestamp using a particular time zone
问题 I am trying to get the Unix timestamp using a particular time zone (not necessarily the same time zone as the system) I tried this : NSDateFormatter *dateFormatter = [[[NSDateFormatter alloc] init] autorelease]; [dateFormatter setDateFormat:@"yyyy-MM-dd HH:mm:ss"]; NSTimeZone *gmt = [NSTimeZone timeZoneWithName:@"Australia/Melbourne"]; [dateFormatter setTimeZone:gmt]; NSString *timeStamp = [dateFormatter stringFromDate:[NSDate date]]; NSDate *curdate = [dateFormatter dateFromString:timeStamp]