jboy.eu

code | media | stuff

Swift DateFormatter sample data

//: Playground - noun: a place where people can play

import Foundation

extension DateFormatter.Style {
    var styleName: String {
        switch self {
        case .full:
            return ".full"
        case .long:
            return ".long"
        case .medium:
            return ".medium"
        case .short:
            return ".short"
        case .none:
            return ".none"
        }
    }
}

let locales = [ Locale(identifier: "de_DE"), Locale(identifier: "en_US"), Locale(identifier: "fr_FR"), Locale(identifier: "es_ES"), Locale(identifier: "ru_RU") ]
let styles = [ DateFormatter.Style.none, DateFormatter.Style.short, DateFormatter.Style.medium, DateFormatter.Style.long, DateFormatter.Style.full ]

let dateFormatter = DateFormatter()

for locale in locales {
    dateFormatter.locale = locale
    print("Locale: \(locale.debugDescription)")
    for timeStyle in styles {
        dateFormatter.timeStyle = timeStyle
        for dateStyle in styles {
            dateFormatter.dateStyle = dateStyle
            print("\ttimeStyle: \(timeStyle.styleName), dateStyle: \(dateStyle.styleName)")
            print("\t\t\(dateFormatter.string(from: Date()))")
        }
    }
}
Locale: de_DE (fixed)
    timeStyle: .none, dateStyle: .none
    
    timeStyle: .none, dateStyle: .short
    02.08.17
    timeStyle: .none, dateStyle: .medium
    02.08.2017
    timeStyle: .none, dateStyle: .long
    2. August 2017
    timeStyle: .none, dateStyle: .full
    Mittwoch, 2. August 2017
    timeStyle: .short, dateStyle: .none
    15:46
    timeStyle: .short, dateStyle: .short
    02.08.17, 15:46
    timeStyle: .short, dateStyle: .medium
    02.08.2017, 15:46
    timeStyle: .short, dateStyle: .long
    2. August 2017 um 15:46
    timeStyle: .short, dateStyle: .full
    Mittwoch, 2. August 2017 um 15:46
    timeStyle: .medium, dateStyle: .none
    15:46:48
    timeStyle: .medium, dateStyle: .short
    02.08.17, 15:46:48
    timeStyle: .medium, dateStyle: .medium
    02.08.2017, 15:46:48
    timeStyle: .medium, dateStyle: .long
    2. August 2017 um 15:46:48
    timeStyle: .medium, dateStyle: .full
    Mittwoch, 2. August 2017 um 15:46:48
    timeStyle: .long, dateStyle: .none
    15:46:48 MESZ
    timeStyle: .long, dateStyle: .short
    02.08.17, 15:46:48 MESZ
    timeStyle: .long, dateStyle: .medium
    02.08.2017, 15:46:48 MESZ
    timeStyle: .long, dateStyle: .long
    2. August 2017 um 15:46:48 MESZ
    timeStyle: .long, dateStyle: .full
    Mittwoch, 2. August 2017 um 15:46:48 MESZ
    timeStyle: .full, dateStyle: .none
    15:46:48 Mitteleuropäische Sommerzeit
    timeStyle: .full, dateStyle: .short
    02.08.17, 15:46:48 Mitteleuropäische Sommerzeit
    timeStyle: .full, dateStyle: .medium
    02.08.2017, 15:46:48 Mitteleuropäische Sommerzeit
    timeStyle: .full, dateStyle: .long
    2. August 2017 um 15:46:48 Mitteleuropäische Sommerzeit
    timeStyle: .full, dateStyle: .full
    Mittwoch, 2. August 2017 um 15:46:48 Mitteleuropäische Sommerzeit
Locale: en_US (fixed)
    timeStyle: .none, dateStyle: .none
    
    timeStyle: .none, dateStyle: .short
    8/2/17
    timeStyle: .none, dateStyle: .medium
    Aug 2, 2017
    timeStyle: .none, dateStyle: .long
    August 2, 2017
    timeStyle: .none, dateStyle: .full
    Wednesday, August 2, 2017
    timeStyle: .short, dateStyle: .none
    3:46 PM
    timeStyle: .short, dateStyle: .short
    8/2/17, 3:46 PM
    timeStyle: .short, dateStyle: .medium
    Aug 2, 2017, 3:46 PM
    timeStyle: .short, dateStyle: .long
    August 2, 2017 at 3:46 PM
    timeStyle: .short, dateStyle: .full
    Wednesday, August 2, 2017 at 3:46 PM
    timeStyle: .medium, dateStyle: .none
    3:46:48 PM
    timeStyle: .medium, dateStyle: .short
    8/2/17, 3:46:48 PM
    timeStyle: .medium, dateStyle: .medium
    Aug 2, 2017, 3:46:48 PM
    timeStyle: .medium, dateStyle: .long
    August 2, 2017 at 3:46:48 PM
    timeStyle: .medium, dateStyle: .full
    Wednesday, August 2, 2017 at 3:46:48 PM
    timeStyle: .long, dateStyle: .none
    3:46:48 PM GMT+2
    timeStyle: .long, dateStyle: .short
    8/2/17, 3:46:48 PM GMT+2
    timeStyle: .long, dateStyle: .medium
    Aug 2, 2017, 3:46:48 PM GMT+2
    timeStyle: .long, dateStyle: .long
    August 2, 2017 at 3:46:48 PM GMT+2
    timeStyle: .long, dateStyle: .full
    Wednesday, August 2, 2017 at 3:46:48 PM GMT+2
    timeStyle: .full, dateStyle: .none
    3:46:48 PM Central European Summer Time
    timeStyle: .full, dateStyle: .short
    8/2/17, 3:46:48 PM Central European Summer Time
    timeStyle: .full, dateStyle: .medium
    Aug 2, 2017, 3:46:48 PM Central European Summer Time
    timeStyle: .full, dateStyle: .long
    August 2, 2017 at 3:46:48 PM Central European Summer Time
    timeStyle: .full, dateStyle: .full
    Wednesday, August 2, 2017 at 3:46:48 PM Central European Summer Time
Locale: fr_FR (fixed)
    timeStyle: .none, dateStyle: .none
    
    timeStyle: .none, dateStyle: .short
    02/08/2017
    timeStyle: .none, dateStyle: .medium
    2 août 2017
    timeStyle: .none, dateStyle: .long
    2 août 2017
    timeStyle: .none, dateStyle: .full
    mercredi 2 août 2017
    timeStyle: .short, dateStyle: .none
    15:46
    timeStyle: .short, dateStyle: .short
    02/08/2017 15:46
    timeStyle: .short, dateStyle: .medium
    2 août 2017 à 15:46
    timeStyle: .short, dateStyle: .long
    2 août 2017 à 15:46
    timeStyle: .short, dateStyle: .full
    mercredi 2 août 2017 à 15:46
    timeStyle: .medium, dateStyle: .none
    15:46:48
    timeStyle: .medium, dateStyle: .short
    02/08/2017 15:46:48
    timeStyle: .medium, dateStyle: .medium
    2 août 2017 à 15:46:48
    timeStyle: .medium, dateStyle: .long
    2 août 2017 à 15:46:48
    timeStyle: .medium, dateStyle: .full
    mercredi 2 août 2017 à 15:46:48
    timeStyle: .long, dateStyle: .none
    15:46:48 UTC+2
    timeStyle: .long, dateStyle: .short
    02/08/2017 15:46:48 UTC+2
    timeStyle: .long, dateStyle: .medium
    2 août 2017 à 15:46:48 UTC+2
    timeStyle: .long, dateStyle: .long
    2 août 2017 à 15:46:48 UTC+2
    timeStyle: .long, dateStyle: .full
    mercredi 2 août 2017 à 15:46:48 UTC+2
    timeStyle: .full, dateStyle: .none
    15:46:48 heure d’été d’Europe centrale
    timeStyle: .full, dateStyle: .short
    02/08/2017 15:46:48 heure d’été d’Europe centrale
    timeStyle: .full, dateStyle: .medium
    2 août 2017 à 15:46:48 heure d’été d’Europe centrale
    timeStyle: .full, dateStyle: .long
    2 août 2017 à 15:46:48 heure d’été d’Europe centrale
    timeStyle: .full, dateStyle: .full
    mercredi 2 août 2017 à 15:46:48 heure d’été d’Europe centrale
Locale: es_ES (fixed)
    timeStyle: .none, dateStyle: .none
    
    timeStyle: .none, dateStyle: .short
    2/8/17
    timeStyle: .none, dateStyle: .medium
    2 ago 2017
    timeStyle: .none, dateStyle: .long
    2 de agosto de 2017
    timeStyle: .none, dateStyle: .full
    miércoles, 2 de agosto de 2017
    timeStyle: .short, dateStyle: .none
    15:46
    timeStyle: .short, dateStyle: .short
    2/8/17 15:46
    timeStyle: .short, dateStyle: .medium
    2 ago 2017 15:46
    timeStyle: .short, dateStyle: .long
    2 de agosto de 2017, 15:46
    timeStyle: .short, dateStyle: .full
    miércoles, 2 de agosto de 2017, 15:46
    timeStyle: .medium, dateStyle: .none
    15:46:48
    timeStyle: .medium, dateStyle: .short
    2/8/17 15:46:48
    timeStyle: .medium, dateStyle: .medium
    2 ago 2017 15:46:48
    timeStyle: .medium, dateStyle: .long
    2 de agosto de 2017, 15:46:48
    timeStyle: .medium, dateStyle: .full
    miércoles, 2 de agosto de 2017, 15:46:48
    timeStyle: .long, dateStyle: .none
    15:46:48 CEST
    timeStyle: .long, dateStyle: .short
    2/8/17 15:46:48 CEST
    timeStyle: .long, dateStyle: .medium
    2 ago 2017 15:46:48 CEST
    timeStyle: .long, dateStyle: .long
    2 de agosto de 2017, 15:46:48 CEST
    timeStyle: .long, dateStyle: .full
    miércoles, 2 de agosto de 2017, 15:46:48 CEST
    timeStyle: .full, dateStyle: .none
    15:46:48 (hora de verano de Europa central)
    timeStyle: .full, dateStyle: .short
    2/8/17 15:46:48 (hora de verano de Europa central)
    timeStyle: .full, dateStyle: .medium
    2 ago 2017 15:46:48 (hora de verano de Europa central)
    timeStyle: .full, dateStyle: .long
    2 de agosto de 2017, 15:46:48 (hora de verano de Europa central)
    timeStyle: .full, dateStyle: .full
    miércoles, 2 de agosto de 2017, 15:46:48 (hora de verano de Europa central)
Locale: ru_RU (fixed)
    timeStyle: .none, dateStyle: .none
    
    timeStyle: .none, dateStyle: .short
    02.08.17
    timeStyle: .none, dateStyle: .medium
    2 авг. 2017 г.
    timeStyle: .none, dateStyle: .long
    2 августа 2017 г.
    timeStyle: .none, dateStyle: .full
    среда, 2 августа 2017 г.
    timeStyle: .short, dateStyle: .none
    15:46
    timeStyle: .short, dateStyle: .short
    02.08.17, 15:46
    timeStyle: .short, dateStyle: .medium
    2 авг. 2017 г., 15:46
    timeStyle: .short, dateStyle: .long
    2 августа 2017 г., 15:46
    timeStyle: .short, dateStyle: .full
    среда, 2 августа 2017 г., 15:46
    timeStyle: .medium, dateStyle: .none
    15:46:48
    timeStyle: .medium, dateStyle: .short
    02.08.17, 15:46:48
    timeStyle: .medium, dateStyle: .medium
    2 авг. 2017 г., 15:46:48
    timeStyle: .medium, dateStyle: .long
    2 августа 2017 г., 15:46:48
    timeStyle: .medium, dateStyle: .full
    среда, 2 августа 2017 г., 15:46:48
    timeStyle: .long, dateStyle: .none
    15:46:48 GMT+2
    timeStyle: .long, dateStyle: .short
    02.08.17, 15:46:48 GMT+2
    timeStyle: .long, dateStyle: .medium
    2 авг. 2017 г., 15:46:48 GMT+2
    timeStyle: .long, dateStyle: .long
    2 августа 2017 г., 15:46:48 GMT+2
    timeStyle: .long, dateStyle: .full
    среда, 2 августа 2017 г., 15:46:48 GMT+2
    timeStyle: .full, dateStyle: .none
    15:46:48 Центральная Европа, летнее время
    timeStyle: .full, dateStyle: .short
    02.08.17, 15:46:48 Центральная Европа, летнее время
    timeStyle: .full, dateStyle: .medium
    2 авг. 2017 г., 15:46:48 Центральная Европа, летнее время
    timeStyle: .full, dateStyle: .long
    2 августа 2017 г., 15:46:48 Центральная Европа, летнее время
    timeStyle: .full, dateStyle: .full
    среда, 2 августа 2017 г., 15:46:48 Центральная Европа, летнее время

github facebook twitter

4856507896573978293098418946942861377074420873513579240196520736 6869851340104723744696879743992611751097377770102744752804905883 1384037549709987909653955227011712157025974666993240226834596619 6060348517424977358468518855674570257125474999648219418465571008 4119086259716947970799152004866709975923596061320725973797993618 8606316914473588300245336972781813914797955513399949394882899846 9178361001825978901031601961835034344895687053845208538045842415 6548248893338047475871128339598968522325446084089711197712769412 0795862440547161321005006459820176961771809478113622002723448272 2493232595472346880029277764979061481298404283457201463489685471 6908235473783566197218622496943162271666393905543024156473292485 5248991225739466548627140482117138124388217717602984125524464744 5055834628144883356319027253195904392838737640739168912579240550 1562088978716337599910788708490815909754801928576845198859630532 3823490558092032999603234471140776019847163531161713078576084862 2363702835701049612595681846785965333100770179916146744725492728 3348691600064758591746278121269007351830924153010630289329566584 3662000800476778967984382090797619859493646309380586336721469695 9750279687712057249966669805614533820741203159337703099491527469 1835659376210222006812679827344576093802030447912277498091795593 8387121000588766689258448700470772552497060444652127130404321182 610103591186476662963858495087448497373476861420880529443

wat?