formatSwiftDate
Signature
Section titled “Signature”formatSwiftDate(value: string): stringWrite an ISO 8601 date as a SWIFT MT value date, YYMMDD. The inverse of parseSwiftDate.
- What it writes. The six-digit value date (
<DATE2>,6!n) that SWIFT’s rule covers: field 32A of MT 910, and fields 30 and 32A of category 1 and 2 messages other than the common group messages n92, n95 and n96. Two digits each of year, month and day. valueis a date, asisValidDateaccepts it, in the ISO calendar. A date-time, an instant or a non-ISO calendar returns"": a date-time names a calendar date only in a zone, so take the date in the zone you mean first.- The year must be 2001 to 2060, the range SWIFT accepts for those value dates. Any other year returns
"": written as two digits, it would read back as another year or be refused with error T50. SoparseSwiftDate(formatSwiftDate(d))reads back as the same date, writtenYYYY-MM-DD(ditself whendis already written that way). - Sources. SWIFT Standards MT General Information (Standards MT November 2025), §6.3.1 Dates and §6.3.6 Value Date Ordering: https://www2.swift.com/knowledgecentre/rest/v1/publications/usgi_20250718/2.0/usgi_20250718.pdf
- Returns
""for a non-string argument.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
value | string | An ISO 8601 calendar date (e.g. “2024-06-15”) |
Returns
Section titled “Returns”the YYMMDD string (“240615”), or "" on invalid input
Examples
Section titled “Examples”import { formatSwiftDate } from "@northguild/gmt/finance/format";
formatSwiftDate("2024-06-15") // "240615"Source
Section titled “Source”© 2026 NorthGuild · Licences
Code examples: MIT-0. Packages: MIT. Third-party data and components: their own licences, credited where they appear. Everything else: © 2026 NorthGuild, all rights reserved.