Skip to content

StructureFoundationEssentials

Date.FormatString

iOS 15.0+ iPadOS 15.0+ Mac Catalyst 15.0+ macOS 12.0+ tvOS 15.0+ watchOS 8.0+
A type that represents a fixed date format string using string interpolation.
struct FormatString

Overview

Use Date.FormatString with Date.VerbatimFormatStyle or Date.ParseStrategy to create fixed-pattern format strings for dates. You build format strings using string interpolation with date field symbols:

let format: Date.FormatString = "\(year: .defaultDigits)-\(month: .twoDigits)-\(day: .twoDigits)"

Topics

Default Implementations

Relationships

Conforms To

  • Swift.Copyable
  • Swift.Equatable
  • Swift.Escapable
  • Swift.ExpressibleByExtendedGraphemeClusterLiteral
  • Swift.ExpressibleByStringInterpolation
  • Swift.ExpressibleByStringLiteral
  • Swift.ExpressibleByUnicodeScalarLiteral
  • Swift.Hashable
  • Swift.Sendable
  • Swift.SendableMetatype