Forum Moderators: coopster
My problem is that i will be having a lot of scripts for comparing the date fields and I just wanna make sure I do my best from the beginning.
There will be a lot of entries in the db and i'm looking for the most efficient memory and processing usage as well as fastest time for queries.
Bottom line:
What is the best type? Why?
Another caution: you must check your string length and see if its a valid one, restrict your db table to accept only specific length strings, and more precautions .... only because you do no use int as your field type.
On te other hand you can save your dates as date in your mysql db - you can perform various things directly into the db instead of the script, like bilenkyj suggested.
One thing... you need to convert your db dates with mktime() or strtotime(), before posting them to your pages.
It is more convinient to see March 28, 2008 (or even 28-03-2008), insted of 2008-03-27 13:45:12 (db format)
On te other hand you can save your dates as date in your mysql db - you can perform various things directly into the db instead of the script, like bilenkyj suggested.
Yes, just to reiterate... I would have thought storing your dates in your DB's own date format rather than a unix timestamp was perhaps the better solution, unless you have a valid reason not to? Particularly since you state:
i'm looking for the most efficient memory and processing usage as well as fastest time for queries.
time for query = time to process DB query + time for PHP to process the results.