DateDecodingStrategy

public enum DateDecodingStrategy

The strategy to use for decoding Date values.

  • Defer to Date for decoding. This is the default strategy.

    Declaration

    Swift

    case deferredToDate
  • Decode the Date as a UNIX timestamp from a JSON number.

    Declaration

    Swift

    case secondsSince1970
  • Decode the Date as UNIX millisecond timestamp from a JSON number.

    Declaration

    Swift

    case millisecondsSince1970
  • Decode the Date as an ISO-8601-formatted string (in RFC 3339 format).

    Declaration

    Swift

    case iso8601
  • Decode the Date as a string parsed by the given formatter.

    Declaration

    Swift

    case formatted(DateFormatter)
  • Decode the Date as a custom value decoded by the given closure.

    Declaration

    Swift

    case custom((_ decoder: Decoder) throws -> Date)