Skip to content

Instantly share code, notes, and snippets.

View tristandl's full-sized avatar

Tristan Ludowyk tristandl

View GitHub Profile
/*
* This will convert DateTime (.NET) object serialized as JSON by WCF to a NSDate object.
*/
// Input string is something like: "/Date(1292851800000+0100)/", "\/Date(1292851800000-0100)\/" or "/Date(1292851800000)/" where
// 1292851800000 is milliseconds since 1970 and +0100 is the timezone
NSString *inputString = [item objectForKey:@"DateTimeSession"];
// This will tell number of seconds to add according to your default timezone
// Note: if you don't care about timezone changes, just delete/comment it out