FASTBCP_DATEFORMAT
Overview
The FASTBCP_DATEFORMAT environment variable lets you specify a custom format string for converting date values to strings in the output. When not set, FastBCP uses the ISO 8601 default yyyy-MM-dd.
The format string follows .NET standard and custom date/time format patterns.
Syntax
Windows
$env:FASTBCP_DATEFORMAT = "yyyyMMdd"
Linux/macOS
export FASTBCP_DATEFORMAT=yyyyMMdd
Configuration
| Property | Value |
|---|---|
| Type | Format string |
| Default | yyyy-MM-dd |
| Applies to | All output formats that serialize date columns as strings (CSV, JSON, etc.) |
| Since | FastBCP 1.0 |
Format Examples
| Format string | Example output |
|---|---|
yyyy-MM-dd (default) | 2026-06-28 |
yyyyMMdd | 20260628 |
dd/MM/yyyy | 28/06/2026 |
MM-dd-yyyy | 06-28-2026 |
yyyy/MM/dd | 2026/06/28 |
Examples
Compact date format — no separators (PowerShell)
$env:FASTBCP_DATEFORMAT = "yyyyMMdd"
fastbcp -S myserver.database.windows.net `
-d MyDatabase `
-T dbo.MyTable `
--fileoutput "output.csv"
Output column value: 20260628
Compact date format — no separators (Linux/macOS)
export FASTBCP_DATEFORMAT=yyyyMMdd
fastbcp -S myserver.database.windows.net \
-d MyDatabase \
-T dbo.MyTable \
--fileoutput "output.csv"
Output column value: 20260628
Restore default ISO 8601 format
Windows
Remove-Item Env:FASTBCP_DATEFORMAT
Linux/macOS
unset FASTBCP_DATEFORMAT