Page 1 of 1

How should the date be stored in the database ???

Posted: Mon Oct 28, 2002 10:59 pm
by rlogin
I have a query on the format in which date should be stored in the database.
In PHP time() function may be used to get the unix timestamp.
This may be converted into any format i desire using strftime() function.

In my application i always use this. At the db level, i simply have a bigint ( i use postgres SQL) field which simply treats this time stamp as a integer.
This works perfeectly for my application.

But there are also, the date and time data types of My SQL and PGSQL.

My contention used to be that durig report generation especially when i have records of the order of 5000000 out of which about 100 need to be selected, based on time stamp, having a select on integer will give me faster response time...
Any one out here has any similar experience or a better explanation, i would appreciate a discussion on the usage of database time formats and the places where they would be of use....
Rgds