Skip to content

Cocoa library used to parse and generate date strings encoded using Microsoft JSON formats.

Notifications You must be signed in to change notification settings

IAMPetro/MSJSONDate

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

MSJSONDate

Cocoa library used to parse and generate date strings encoded using Microsoft JSON formats.

There are three general formats supported,

  1. DateTime without offset data

    "/Date(1198908717056)/"

  2. DateTime with offset data

    "/Date(1198908717056+0500)/"

  3. DateTimeOffset

    {
        DateTime: "/Date(1198908717056)/",
        OffsetMinutes: "-360"
    }
    

Usage

Operations can take place using either the MSJSONDate class methods, or the MSJSONDate category for NSDate instances.

Example snippet:

id json = [NSJSONSerialization JSONObjectWithData:data options:kNilOptions error:nil];
id dateElement = json[@"DateLastModified"];
NSDate *date = [MSJSONDate dateWithJSON:dateElement];

Example snippet:

NSDate *date = [NSDate date];
NSMutableDictionary *jsonElement = [NSMutableDictionary new];
[jsonElement setObject:[date jsonValue] forKey:@"DateLastModified"];

Installation

  • Download MSJSONDate
  • Unzip and import the MSJSONDate subdirectory into your Xcode project.
  • Simply #import "MSJSONDate.h" in your implementation files to get started.

License

MSJSONDate was created by Cory Metcalfe (coryallegory), and is available under the MIT license. See the LICENSE file for more info.

About

Cocoa library used to parse and generate date strings encoded using Microsoft JSON formats.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published