Skip to content

Instantly share code, notes, and snippets.

@bendytree
Last active December 10, 2015 06:28
Show Gist options
  • Select an option

  • Save bendytree/4394718 to your computer and use it in GitHub Desktop.

Select an option

Save bendytree/4394718 to your computer and use it in GitHub Desktop.
Example of OKDate
// create a date
OKDate* a = [OKDate dateWithNumbers:@[2013, 6, 16, 8, 0, 0]];
[a addDays:2]; //add 2 days
a.minute = 30; //set minutes to 30
// render to "2013-06-18 8:30AM"
NSString* b = [a format:@"yyyy-MM-dd H:mma"];
// parse a date
OKDate* c = [OKDate parseDate:@"2013-01" format:@"yyyy-MM"];
// render a date to ISO8601 standard
NSString* d = [c iso8601];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment