Skip to content

Instantly share code, notes, and snippets.

@Eridana
Last active August 29, 2015 14:16
Show Gist options
  • Save Eridana/7caa3ffe8719e5f210a3 to your computer and use it in GitHub Desktop.
Save Eridana/7caa3ffe8719e5f210a3 to your computer and use it in GitHub Desktop.
Generate random unique string value
NSTimeInterval today = [[NSDate date] timeIntervalSince1970];
NSString *intervalString = [NSString stringWithFormat:@"%f", today];
NSDate *date = [NSDate dateWithTimeIntervalSince1970:[intervalString doubleValue]];
NSDateFormatter *formatter=[[NSDateFormatter alloc]init];
[formatter setDateFormat:@"yyyyMMddhhmm"];
NSString *strValue = [formatter stringFromDate:date];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment