---
title: Format one or two dates as an EDI file date string
summary: Format a start date, and optional end date, into an EDI file date string.
status: draft
owner: saif-docgen
last_reviewed: 2026-09-15
library: SAIF.Framework.Common
reference_type: package
operation_id: OP-012
trigger: Caller names or stamps an interchange file*
---

# Format one or two dates as an EDI file date string

Format a start date, and optional end date, into an EDI file date string, triggered when caller names or stamps an interchange file*.

| Field | Value |
| --- | --- |
| **Operation ID** | OP-012 |
| **Trigger** | Caller names or stamps an interchange file* |
| **Inputs** | `startDate`, optional `endDate` |
| **Outputs** | `String` (`yyyymmdd` or `yyyymmdd-yyyymmdd`) |
| **Primary components** | ``DateMaker.EdiFileDateString(DateTime startDate, DateTime? endDate)`` |
| **Entry point** | `Common/SAIF.Common/Classes/DateMaker.cs` |

## Steps

1. Format `startDate` with the `DateFormat` constant `"yyyyMMdd"`. ([BR-030](../business-rules.md#br-030-edi-file-date-strings-use-the-yyyymmdd-format-and-the---separator-between-a-start-and-an-end-date))
2. If `endDate` is non-null, append `DateSeperator` (`'-'`) plus the end date formatted the same way. ([BR-030](../business-rules.md#br-030-edi-file-date-strings-use-the-yyyymmdd-format-and-the---separator-between-a-start-and-an-end-date))
3. Return the assembled string.

## Process flow

The following diagram visualizes this operation's control flow.

```mermaid
flowchart TD
	Start(["Caller names or stamps<br>an interchange file"]) --> S1["Format startDate with<br>'yyyyMMdd' mask"]
	S1 --> C1{"endDate is<br>non-null?"}
	C1 -->|Yes| S2["Append '-' separator and<br>formatted endDate"]
	C1 -->|No| S3["Keep start-date-only string"]
	S2 --> End([Return assembled string])
	S3 --> End
```

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

> **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/DateMaker.cs`
