What would be the best way to store date and time in sql databases? Should i use date() or is there some other better way to do it? and if i should be able to sort by the dates, what kind of sql row should it be set to? a timestamp or datetime?
Asked
Active
Viewed 90 times
1 Answers
2
Both, the DATETIME
and TIMESTAMP
can be sorted in their default formats. Using one of these two is the best way to follow instead of storing them as VARCHAR or other data-types.
I personally prefer using DATETIME
over TIMESTAMP
because of the limitation applied to it.

hjpotter92
- 78,589
- 36
- 144
- 183