GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - pushd/iso8601: NSFormatter for ISO 8601

BranchesTags
Open more actions menu
 
 

Latest commit

 

History

45 Commits
45 Commits

Folders and files

NameName
Last commit message
Last commit date
ISO8601.xcodeproj
ISO8601.xcodeproj
 
 
ISO8601
ISO8601
 
 
ISO8601Tests
ISO8601Tests
 
 
Tools
Tools
 
 
.gitignore
.gitignore
 
 
.travis.yml
.travis.yml
 
 
[email protected]
[email protected]
 
 
ISO8601-re2c.podspec
ISO8601-re2c.podspec
 
 
LICENSE
LICENSE
 
 
NJISO8601.podspec
NJISO8601.podspec
 
 
Package.swift
Package.swift
 
 
README.md
README.md
 
 

Repository files navigation

NSFormatter for ISO 8601

A Cocoa NSFormatter subclass for converting ISO 8601 formatted string to NSDate, and vice versa.

The parser is implemented using re2c. Thanks to re2c, it is much faster than NSDateFormatter is.

Installation

NJISO8601 is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod "NJISO8601"

Note that the generated parser is committed directly to this repository. This may not be optimal.

There have been attemts to use cocoapods' prebuild command to fix this, with limited success. Check the podspec for attempted solution.

Usage

To convert ISO 8601 string to NSDate. You can use NJISO8601DateFromString() function without any configuration.

NSDate *date = NJISO8601DateFromString(@"2011-02-27T11:03:06+09:00");

or, you can use the NJISO8601Formatter the same way as you do with NSDateFormatter.

NJISO8601Formatter *formatter = [[NJISO8601Formatter alloc] init];

NSDate *date = [formatter dateFromString:@"2011-02-07T11:03:06+09:00"];

To convert NSDate to ISO 8601 formatted string.

NJISO8601Formatter *formatter = [[NJISO8601Formatter alloc] init];

NSString *string = [formatter stringFromDate:date];

Also, you can customize output format like this:

[formatter setDateStyle:NJISO8601FormatterDateStyleWeekExtended];
[formatter setTimeZoneStyle:NJISO8601FormatterTimeZoneStyleExtended];
[formatter setFractionSeparator:NJISO8601FormatterFractionSeparatorDot];
[formatter setFractionDigits:6];
[formatter setTimeZone:[NSTimeZone timeZoneForSecondsFromGMT:(8 * 60 * 60)]];

Supported Formats

  • Calendar Date
  • Ordinal Date
  • Week Date
  • Local Time with Decimal Fractions
  • Midnight
  • Time Zone

Unsupported Formats

  • BC Date
  • Basic Format of Ordinal Date Expanded Representation (Year > 9999)
  • Local Time with Leap Second (Second >= 60.0)
  • Time Inverval
  • Duration
  • Recurring Time Interval

About

NSFormatter for ISO 8601

Resources

Readme
License
Activity
Custom properties

Stars

0 stars

Watchers

0 watching

Forks

0 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.