[EMAIL PROTECTED] [[EMAIL PROTECTED]] wrote:
> Addressed to: "Randy Johnson" <[EMAIL PROTECTED]>
> [EMAIL PROTECTED]
>
> ** Reply to note from "Randy Johnson" <[EMAIL PROTECTED]> Thu, 25 Jan 2001
>11:25:52 -0500
>
> > I am wondering if it would be more efficient to store the integer
> > value that the php function time() returns when a transaction is
> > inserted into the database and then when querying the database to get
> > certain transactions just use basic math functions to get the certain
> > transactions.
> >
> > For example in I wanted to get all the transactions from the last 31
> > days
> >
> > lets say there was 980026719 seconds since 1970 and the number of
> > seconds from the last 31 days is 2678400
> >
>
>
> If you are going to the trouble of using a database, go with it all the
> way and use the date datatype it provides, along with the date
> functions in the database.
But when you start using database date functions, which are
definitely different between databases, you are making your
code dependent on the particular database you write it for -
then to migrate to another database would be a major rework.
If you use a method like unix timestamp for doing your date
math with just standard > or < SQL comparison operators, then
your code is much more database independent, and switching
to a different database becomes much easier. This is just
my 2cents.
--
Hardy Merrill
Mission Critical Linux, Inc.
http://www.missioncriticallinux.com
>
>
> >
> > select from table where time_of_trans >(980026719-2678400)
>
> SELECT whatever
> FROM table
> WHERE time_of_trans > SUBDATE( NOW(), INTERVAL 1 MONTH );
>
> I can assure you considerable thought has been given to the storage of
> data in the database, and the optimization of queries. The format you
> enter and display is not what gets stored in the tables for a date.
>
>
> One cool thing about this, it also works from the command line
> interpreter, and you don't have to figure out what the current time()
> is if you want to run a query by hand.
>
> Take a look at this page if you are using MySQL.
>
>
> http://www.mysql.com/doc/D/a/Date_and_time_functions.html
>
>
> Date_Format() is veryhandy!
>
>
>
>
>
> Rick Widmer
> Internet Marketing Specialists
> http://www.developersdesk.com
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]