Working With Dates, Times, and Timers
This chapter covers how to work with dates and timers using the Foundation framework with Objective-C.
The recipes in this chapter will show you how to:
- Create today’s date using
- Create custom dates using
- Compare dates
- Convert strings to dates
- Format dates for display on user interfaces
- Add and subtract dates
- Use a timer to schedule repeating and non-repeating code
5.1 Creating a Date Object for Today
You need to represent today’s date in your application.
NSDate class method
date to create a date object instance for the current date.
How It Works
NSDate is a class that is generally used with other classes (covered in the upcoming recipes). ...