Skip to content

formatSwiftDate

  • Timestamps in trading and payment messages: FIX UTC timestamps at the precision their digits state, leap seconds included.
formatSwiftDate(value: string): string

Write 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.
  • value is a date, as isValidDate accepts 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. So parseSwiftDate(formatSwiftDate(d)) reads back as the same date, written YYYY-MM-DD (d itself when d is 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.
ParameterTypeDescription
valuestringAn ISO 8601 calendar date (e.g. “2024-06-15”)

the YYMMDD string (“240615”), or "" on invalid input

import { formatSwiftDate } from "@northguild/gmt/finance/format";
formatSwiftDate("2024-06-15") // "240615"
output 

finance/format/formatSwiftDate.ts

© 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.