DateUtils
public enum DateUtils
Aggregates common functions to use with JSONEncoder
-
Converts date to timestamp
Declaration
Swift
public static func dateToTimestamp(date: Date) -> Int64
Parameters
date
date
Return Value
timestamp
-
Converts date to timestamp in milliseconds
Declaration
Swift
public static func dateToMilliTimestamp(date: Date) -> Int64
Parameters
date
date
Return Value
timestamp in milliseconds
-
Creates date from tiemstamp
Declaration
Swift
public static func dateFromTimestamp(_ timestamp: Int64) -> Date
Parameters
timestamp
timestamp
Return Value
date
-
Creates date from timestamp in milliseconds
Declaration
Swift
public static func dateFromMilliTimestamp(_ timestamp: Int64) -> Date
Parameters
timestamp
timestamp in milliseconds
Return Value
date
-
Decodes Date using Int timestamp
Throws
Rethrows fromDecoder
Declaration
Swift
public static func timestampDateDecodingStrategy(decoder: Decoder) throws -> Date
Parameters
decoder
Decoder
Return Value
Decoded Date
-
Encodes Date to Int timestamp
Throws
Rethrows fromEncoder
Declaration
Swift
public static func timestampDateEncodingStrategy(date: Date, encoder: Encoder) throws
Parameters
date
Date to encode
encoder
Encoder
-
Decodes Date using Int64 timestamp in milliseconds
Throws
Rethrows fromDecoder
Declaration
Swift
public static func timestampMilliDateDecodingStrategy(decoder: Decoder) throws -> Date
Parameters
decoder
Decoder
Return Value
Decoded Date
-
Encodes Date to Int64 timestamp in milliseconds
Throws
Rethrows fromEncoder
Declaration
Swift
public static func timestampMilliDateEncodingStrategy(date: Date, encoder: Encoder) throws
Parameters
date
Date to encode
encoder
Encoder