Working With Dates and Times
06 December, 2020
Given the vagaries of the Gregorian calendar, introduced in October 1582, programming involving dates and times can be notoriously difficult to get right.
Fortunately for developers using Apple frameworks the vast majority of the hard work has been done for us.
The following series of articles will explain how to perform some common tasks with dates and times.
Given a value that exists as a
Date and then formatting it as a
String is relatively straightforward and explained well by Paul Hudson.
A more extensive series of examples is provided by Julian Schiavo.
Reading Dates From a String
This essentially involves telling the
DateFormatter class what format to use when parsing the string. You can then generate a value of type
Date using your instance of
DateFormatter. How to read a date from a string is described nicely at Cocoacasts.
In this article, you'll learn how to determine if a given date is within a certain range.