Reputation: 3675
I want to generate monthly & yearly report eventually.
Let say I have a table transaction which consists of (price, date, ...), I want to generate a report which group by month
.
Should I store the date as 3 separate fields day, month, and year? Or I can store it as date with Date
data type?
If date, how is the query look like and how to implement it in iOS?
NOTE: I'm new to iOS
Thanks in advance.
Upvotes: 0
Views: 391
Reputation: 1269503
In databases, you should always want to store dates as dates, not as their component fields.
SQLite provides various functions for manipulating and ordering dates, so you can use them.
Getting the month out of a date is quite easy.
Use the date
.
Upvotes: 1