Skip to content

Instantly share code, notes, and snippets.

@yetanotherchris
Created February 9, 2013 20:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yetanotherchris/4747060 to your computer and use it in GitHub Desktop.
Save yetanotherchris/4747060 to your computer and use it in GitHub Desktop.
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