How do I convert the following Objective-C code into Swift code?
#define MAX_SIZE 11
char buffer[MAX_SIZE];
time_t time = [[NSDate date] timeIntervalSince1970];
strftime(buffer, MAX_SIZE, "%-l:%M\u2008%p", localtime(&time));
NSString *dateString = [NSString stringWithUTF8String:buffer];
NSLog(@"dateString: %@", dateString); // dateString: 11:56 PM
I'm formatting a date
.
NSDateFormatter
– ResectNSDateFormatter
instead ofstrftime(3)
– Crenelate