Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
C# to Objective C by example #8
+(NSString*) todaysDate
// This is an example of date formatting in objective-c/foundation.
// The DateFormatter performs a role similar to DateTime.ToString, there is
// also a fairly rich API in the NSDate class for doing date comparisons and creating new dates.
NSDate *now = [NSDate date];
NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
[formatter setDateFormat:@"dd MM YYYY"];
NSString *result = [formatter stringFromDate:now];
[formatter release];
return result;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.