Skip to content

Commit

Permalink
Add Gregorian to Julian conversion example
Browse files Browse the repository at this point in the history
  • Loading branch information
sbooth committed Nov 4, 2023
1 parent 08b2451 commit da6a322
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ For reference, these limits correspond to the following dates and times which sh

```swift
let jd = AstronomicalCalendar.dateToJulianDate(year: 1919, month: 5, day: 29)
// JulianDayNumber.JulianDate 2422107.5
// 2422107.5
```

> [!NOTE]
Expand All @@ -74,6 +74,14 @@ let d = Date(julianDate: 2422107.5)
// Foundation.Date 1919-05-29 00:00:00 UTC
```

3. Convert the Gregorian calendar date 2013-10-31 to the Julian calendar.

```swift
let j = GregorianCalendar.dateToJulianDayNumber(year: 2013, month: 10, day: 31)
let julianYMD = JulianCalendar.julianDayNumberToDate(j)
// (year: 2013, month: 10, day: 18)
```

## License

JulianDayNumber is released under the [MIT License](https://github.com/sbooth/JulianDayNumber/blob/main/LICENSE.txt).

0 comments on commit da6a322

Please sign in to comment.