Skip to content

Encode a DateTime as a Julian string

Encode a DateTime as a Julian-format string, triggered when caller produces a Julian-formatted date for file interchange*.

Field Value
Operation ID OP-009
Trigger Caller produces a Julian-formatted date for file interchange*
Inputs date, yearLength
Outputs string
Primary components Julian.ToJulian(this DateTime date, int yearLength = 2)
Entry point Common/SAIF.Common/Classes/Julian.cs

Steps

  1. If yearLength == 2, format the year as "yy" and convert to Int32 (dropping any leading zero); otherwise use the full four-digit date.Year. (BR-027)
  2. Format date.DayOfYear with the "000" mask so it is always three digits. (BR-027)
  3. Concatenate year + day and return.

Process flow

The following diagram visualizes this operation's control flow.

flowchart TD
    Start(["Caller requests Julian<br>date encoding"]) --> Check{"yearLength == 2?"}
    Check -->|Yes| Y2["Format year as 'yy'<br>convert to Int32"]
    Check -->|No| Y4["Use full four-digit<br>date.Year"]
    Y2 --> Day["Format DayOfYear<br>with '000' mask"]
    Y4 --> Day
    Day --> Concat["Concatenate year + day"]
    Concat --> End([Return Julian string])

Note: Statements marked with * were inferred from code structure, naming conventions, or contextual evidence where direct confirmation was not available in source artifacts.

Sources

  • Common/SAIF.Common/Classes/Julian.cs