Swift Date Components & Calculations Tutorial

Поделиться
HTML-код
  • Опубликовано: 2 окт 2024
  • Go to squarespace.co... to save 10% off your first purchase of a website or domain using code SEANALLEN.
    In this video I show you how to create a Swift Date object from DateComponents and use those dates to demonstrate a few different calculations. I show you how to add or subtracts dates from each other, how to get the time interval between two dates and how to check if two dates are in the same time period. Swift's Calendar object is what makes this all relatively simple for us developers.
    My iOS Dev Courses:
    seanallen.teac...
    Project Source Code:
    seanallen.teac...
    X (Twitter):
    Sean Allen - / seanallen_dev
    Hired.com:
    hired.com/x/1n01g
    Book and learning recommendations that help out the channel if you decide to purchase (Affiliate Links):
    Paul Hudson's Hacking With Swift:
    gumroad.com/a/...
    Donny Wals - Combine:
    gumroad.com/a/...
    Mark Moeyken’s SwiftUI Books:
    www.bigmountainstudio.com/swiftui-views-book/fzc51
    Objc.io Books (Thinking in SwiftUI & Advanced Swift):
    gumroad.com/a/...
    Timestamps:
    0:00 - Date Components
    0:51 - Create a Date from DateComponents
    3:08 - Get Specific Component from a Date
    5:12 - Add or Subtract Date from other Date
    6:38 - Get Start/End of Time Period from Date
    8:47 - Get Time Interval Between Dates
    9:50 - Are Two Dates in the Same Time Period
    #swift #softwaredeveloper #iosdeveloper

Комментарии • 28

  • @seanallen
    @seanallen  10 месяцев назад +2

    Learn more with my iOS Dev Courses & Source Code - seanallen.teachable.com

  • @lizzysophiebrown
    @lizzysophiebrown Месяц назад

    I've tried to watch this video so many times but have been thinking its too hard so give up. Finally sat down to watch it and you make it make sense. I've watched so many of your videos whilst learning to code. Thank you for making them. I have learnt a lot.

  • @clayclay7063
    @clayclay7063 3 месяца назад +1

    Appreciate the content. Your vids are the best! 👍

    • @seanallen
      @seanallen  3 месяца назад

      Thanks for the kind words :)

  • @NavpreetKailay
    @NavpreetKailay Месяц назад +1

    Thanks Sean, Great content.

    • @seanallen
      @seanallen  Месяц назад

      Glad you enjoyed it!

  • @leifashley
    @leifashley Месяц назад

    Almost read this as dating... :)

  • @chrispy104k
    @chrispy104k 10 месяцев назад +2

    Dealing with dates always do my head in so this is very timely Sean. Thanks heaps mate.

    • @seanallen
      @seanallen  10 месяцев назад

      Happy to help!

  • @trevormills
    @trevormills 10 месяцев назад +2

    Excellent tutorial Sean - Thanks

    • @seanallen
      @seanallen  10 месяцев назад

      Glad it was helpful!

  • @AndrewDChristie
    @AndrewDChristie 7 месяцев назад +1

    Thanks!

    • @seanallen
      @seanallen  7 месяцев назад

      I appreciate that, Andrew :)

  • @victorriurean
    @victorriurean 10 месяцев назад +2

  • @AndyJMacLeod
    @AndyJMacLeod 3 месяца назад +1

    Great tutorial. I keep coming back to it for reference.

    • @seanallen
      @seanallen  3 месяца назад

      Date math is fun, isn't it?

  • @Notkdenben
    @Notkdenben 9 месяцев назад +1

    This was the video I needed a year ago when I came up with an idea for an app, but I struggled with it back then. Glad to see this is available now

    • @seanallen
      @seanallen  9 месяцев назад +1

      A lot struggle when working with dates. Wish I coulda helped back then!

    • @Notkdenben
      @Notkdenben 7 месяцев назад

      @@seanallenyou helped with a lot of other things! No sweat

  • @pavanj3666
    @pavanj3666 10 месяцев назад

    Hello sir…. I randomly found ur content i loved it…. I am college dropout and i wanted to get a job in tech…. is it possible…? Please help me to choose between python and swift to get a job… thank you…

    • @seanallen
      @seanallen  10 месяцев назад

      It's absolutely possible. I'm not saying it will be easy, but it's possible.

    • @pavanj3666
      @pavanj3666 10 месяцев назад

      @@seanallen i am confused to choose a career path.. should i go with python or should i choose swift to get a job …

  • @soheilpakgohar6630
    @soheilpakgohar6630 9 месяцев назад +1

    thank you Sean.

    • @seanallen
      @seanallen  9 месяцев назад

      You're welcome :)

  • @efecetin8475
    @efecetin8475 9 месяцев назад

    Thank you !

  • @awakeFromNib
    @awakeFromNib 10 месяцев назад +1

    Awesome!

  • @JasonMitchellAZ
    @JasonMitchellAZ 9 месяцев назад

    I've spent more time learning about and messing with Date/Calendar than I'd like in building my app, but I've only scratched the surface. Great tutorial, Sean.