Skip to content
0:00 / 0:00

#swift#dateformatter#nsdateformatter

Swift Tutorial: DateFormatter (dateStyle, Locale, am/pm, dateFormat, weekdaySymbols)

Swift Goose

3.2K subscribers • 8 videos on Hallway

YouTube
  • Recommended by 1 person: 1 in engineering communities.

Beginner. No background in the topic needed.

1.8K views5 years ago1 recommendation

Programming languagesMobile developmentSwiftiOS and SwiftUI

How to format dates and times in Swift using DateFormatter styles, locales, and custom formats.

In this Swift tutorial we’ll look at how to use DateFormatter to format dates in both a pre-defined way using Swift’s ‘style’ enums, as well as custom formats using dateFormat. We’ll format date, time, weekday symbols, and more. Days: E, EE, EEE - Wed EEEE - Wednesday / or weekday symbol EEEEE - W Months: M - 4 MM - 04 MMM - Apr MMMM - April MMMMM - A Years: Y - 2021 YY - 21 YYY - 2021 YYYY - 2021 year: y, yy, yyy, yyyy - 2021 Time Zone: Z, ZZ, ZZZ - - ZZZZ - GMT- Hit the like button, comment, subscribe, and hit the dinner bell to be notified of my next video! If you'd like to support my work to help me improve video quality and bring more content, please consider donating to my PayPal: paypal.com/paypalme/SwiftGoose Intro Create DateFormatter() AM and PM symbols dateStyle timeStyle Locale dateFormat Days of the week (E) weekdaySymbols Months (M) Years (Y) Seconds (s and S) Time zone (Z) setLocalizedDateFormatFromTemplate End Subscribe for more content, as I will be creating more tutorial and how-to videos for coding in Swift, as well as longer tutorials on building macOS apps. Thank you for watching! Huge thank you to the channels below for helping me get started! Uncreated Light Press youtube.com/channel/UCcNI7mR_Nzulq0THjdrzlag and Mr. Macintosh youtube.com/channel/UC7FRPWLwRlhORhFHHywfqAg and The Apple Ninja youtube.com/c/JesseTheAppleNinja

Why it's here

1 person recommends this

What people say. Recommended as a quick and comprehensive reference for formatting dates in Swift.

u/Water-Cookiesin r/swift • Recommends

Swift Tutorial: DateFormatter (dateStyle, Locale, am/pm, dateFormat, weekdaySymbols)