         }
     }
 
-    public func toOrdinalDay(year: Int64, month: Int8, day: Int8) -> Int64 {
-        return 0;
+    ///
+    /// Convert from year, month and date to ordinal date
+    ///
+    public func ordinalDay(year year: Int64, month: Int8, day: Int8) -> Int64 {
+        if isLeapYear(year) {
+            return maxFirstDayOfMonth[month - 1] + Int64(day)
+        } else {
+            return minFirstDayOfMonth[month - 1] + Int64(day)
+        }
     }
 
-    public func fromOrdinalDay(day: Int64) -> (year: Int64, month: Int8, day: Int8) {
-        return (0, 0, 0)
+    ///
+    /// Convert from year and ordinal date to month and day
+    ///
+    public func ordinalDay(year year: Int64, day: Int64) -> (Int8, Int8) {
+
+        let days = isLeapYear(year) ? maxDaysInMonth : minDaysInMonth
+
+        // TODO: Über-naive implementation. Should be fixed
+        var _day = day
+        var _month = 1
+        for i in 0...11 {
+            let d = Int64(days[i])
+            if _day > d {
+                _month += 1
+                _day -= d
+            } else {
+                break
+            }
+        }
+
+        return (Int8(_month), Int8(_day))
+    }
+
+    ///
+    /// Get the number of days between the given years
+    ///
+    /// - Parameter from: Start year (inclusive)
+    /// - Parameter to  : End year (exclusive)
+    ///
+    public func daysBetween(from from: Int64, to: Int64) -> Int64 {
+        var days = (to - from) * 365
+        days += leapYears(from: from, to: to)
+        return days
     }
 
     ///

}

public class ISOChronology : Chronology {
    private let minDaysInMonth = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
    private let maxDaysInMonth = [31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]

    public init() {}

    public func daysInMonth(month: Int8, year: Int64) -> Int8 {
        if (isLeapYear(year)) {
            return Int8(maxDaysInMonth[month - 1])
        } else {
            return Int8(minDaysInMonth[month - 1])
        }
    }

    public func isLeapYear(year: Int64) -> Bool {
        if year % 4 != 0 {
            return false

public protocol Chronology {

    /// Convert the given date into an ordinal day
    func ordinalDay(year year: Int64, month: Int8, day: Int8) -> Int64

    /// Convert the given ordinal day into a date
    func ordinalDay(year year: Int64, day: Int64) -> (Int8, Int8)

    /// Check if the given year is a leap year
    func isLeapYear(year: Int64) -> Bool
