So, I'm looking to store a date in my SQL database, and I'm not sure what the most efficient way would be. I thought of two different methods.
Firstly, people will be able to set a certain price for each day.
For instance:
March 8, 2011: $ 1
March 9, 2011: $ 2
March 10, 2011: $ 5
For my database, I thought of either storing the UNIX timestamp, or storing the month, day, and year in separate fields.
First method:
UNIX Timestamp
pros
against
- Need to convert date to timestamp
- You must search between start and end dates
- Search Error Prevention
Month / day / year
pros
against
- Additional fields
- Takes up more space
- Will store a lot of data, which can slow down the database.
, ? ( , .)