LXDateFormatter

public class LXDateFormatter

Instances of LXDateFormatter create string representations of NSDate objects. There are several built-in formats available, or a custom format can be specified in the same format as in NSDateFormatter objects.

  • Converts NSDate objects into datetime strings in the format yyyy-MM-dd HH:mm:ss.SSS, using the UTC timezone.

    Declaration

    Swift

    public class func standardFormatter() -> Self
  • Converts NSDate objects into time-only strings in the format HH:mm:ss.SSS, using the UTC timezone.

    Declaration

    Swift

    public class func timeOnlyFormatter() -> Self
  • Converts NSDate objects into date-only strings in the format yyyy-MM-dd, using the UTC timezone.

    Declaration

    Swift

    public class func dateOnlyFormatter() -> Self
  • Converts NSDate objects into strings following the ISO 8601 combined datetime format, using the UTC timezone.

    Declaration

    Swift

    public class func ISO8601DateTimeFormatter() -> Self
  • Creates a new LXDateFormatter instance.

    Declaration

    Swift

    public required init(formatString: String, timeZone: NSTimeZone = NSTimeZone(forSecondsFromGMT: 0))

    Parameters

    formatString

    The desired format string used to convert dates to strings. Uses the same format string as NSDateFormatter.dateFormat.

    timezone

    An NSTimeZone instance representing the desired time zone of the date string output. Defaults to UTC.