Database date time how to setup
Posted: Tue Mar 04, 2008 11:25 pm
Hi,
I setting up differtent databases but i don;t know what is the most smart setting to punt the time on the database, so you can easy do queries
Now on my database i get a unix timestamp but I think it is not handy
I want to selecct on date hour etc. Must i make a table for hours and date seperate?
-------+---------------------+-------+----------+
| dtKey | time | water | verbruik |
+-------+---------------------+-------+----------+
| 114 | 2008-03-04 22:00:02 | 2442 | 9.5 |
| 113 | 2008-03-04 21:00:01 | 2423 | 0.5 |
| 112 | 2008-03-04 20:00:01 | 2422 | 90.0 |
| 111 | 2008-03-04 19:00:01 | 2242 | 67.5 |
| 110 | 2008-03-04 18:00:02 | 2107 | 7.0 |
I setting up differtent databases but i don;t know what is the most smart setting to punt the time on the database, so you can easy do queries
Now on my database i get a unix timestamp but I think it is not handy
I want to selecct on date hour etc. Must i make a table for hours and date seperate?
-------+---------------------+-------+----------+
| dtKey | time | water | verbruik |
+-------+---------------------+-------+----------+
| 114 | 2008-03-04 22:00:02 | 2442 | 9.5 |
| 113 | 2008-03-04 21:00:01 | 2423 | 0.5 |
| 112 | 2008-03-04 20:00:01 | 2422 | 90.0 |
| 111 | 2008-03-04 19:00:01 | 2242 | 67.5 |
| 110 | 2008-03-04 18:00:02 | 2107 | 7.0 |