---
title: Resolve the year and leap-year flag from a Julian string
summary: Resolve a 4-digit calendar year and leap-year flag from a Julian string.
status: draft
owner: saif-docgen
last_reviewed: 2026-09-15
library: SAIF.Framework.Common
reference_type: package
operation_id: OP-008
trigger: Called by OP-007 step 3, or directly by callers
---

# Resolve the year and leap-year flag from a Julian string

Resolve a 4-digit calendar year and leap-year flag from a Julian string, triggered when called by OP-007 step 3, or directly by callers.

| Field | Value |
| --- | --- |
| **Operation ID** | OP-008 |
| **Trigger** | Called by OP-007 step 3, or directly by callers |
| **Inputs** | `julian`, `millenium` |
| **Outputs** | `int` year, `out bool isLeapYear` |
| **Primary components** | ``Julian.GetYear(string julian, out bool isLeapYear, int millenium = 0)`` |
| **Entry point** | `Common/SAIF.Common/Classes/Julian.cs` |

## Steps

1. If `millenium < 1000`, derive it from the current system year: take the first digit of `DateTime.Now.Year` and multiply by 1000 (yields 2000 for any year 2000-2999). ([BR-024](<../business-rules.md#br-024-when-no-millennium-is-supplied-(or-it-is-below-1000)%2C-the-millennium-is-derived-from-the-current-system-year's-first-digit-x-1000%2C-and-a-1--or-2-digit-julian-year-is-offset-by-it>))
2. If the Julian string is longer than 3 characters, parse everything before the final three characters as the year component; otherwise default the year to the millennium.
3. If the resulting year is below 1000 (a 1- or 2-digit year was supplied), add the millennium to it. ([BR-024](<../business-rules.md#br-024-when-no-millennium-is-supplied-(or-it-is-below-1000)%2C-the-millennium-is-derived-from-the-current-system-year's-first-digit-x-1000%2C-and-a-1--or-2-digit-julian-year-is-offset-by-it>))
4. Instantiate `System.Globalization.JulianCalendar` and set `isLeapYear` from `calendar.IsLeapYear(year)`. ([BR-025](<../business-rules.md#br-025-leap-year-status-is-determined-using-the-julian-calendar-(system.globalization.juliancalendar)%2C-not-the-gregorian-calendar>))
5. Return the resolved year.

## Process flow

The following diagram visualizes this operation's control flow.

```mermaid
flowchart TD
	Start(["GetYear(julian, out isLeapYear,<br>millenium) called"]) --> M{"millenium < 1000?"}
	M -->|Yes| DeriveM["Derive millennium from current<br>year's first digit x 1000"]
	M -->|No| LenCheck
	DeriveM --> LenCheck{"Julian string longer<br>than 3 characters?"}
	LenCheck -->|Yes| ParseYear["Parse chars before final<br>three as year component"]
	LenCheck -->|No| DefaultYear["Default year to millennium"]
	ParseYear --> YearCheck
	DefaultYear --> YearCheck{"Resulting year < 1000?"}
	YearCheck -->|Yes| AddM["Add millennium to year"]
	YearCheck -->|No| Calendar
	AddM --> Calendar["Instantiate JulianCalendar;<br>set isLeapYear"]
	Calendar --> End(["Return resolved year"])
```

## Related documentation
- [Operations and processes](../operations-processes.md)
- [Business rules](../business-rules.md)

## Sources
- `Common/SAIF.Common/Classes/Julian.cs`
