in reply to Re: Re: Re: MySQL Timestamp comparison
in thread MySQL Timestamp comparison

Very true, but in you have already included a MySQL specific function (UNIX_TIMESTAMP) in your above example thus excluding you from any platform independence. Having one function in your script that requires MySQL forces all the rest of your script to require it as well by default (unless you do some sort of modularized set up, but a simple script won't cope.) Therefore your argument of having the subroutine to do the conversion to be cross platform is moot because you are already requiring MySQL.
  • Comment on Re: Re: Re: Re: MySQL Timestamp comparison

Replies are listed 'Best First'.
Re: Re: Re: Re: Re: MySQL Timestamp comparison
by Ninthwave (Chaplain) on Oct 30, 2003 at 20:57 UTC

    How would you make it cross platform. Would it be better to take the time stamping function away from the database and have the scripts create and store the time stamp in an Integer on the database. That way there would be no need for conversion no matter what the database. So what is the benefit of the timestamp function beside having the database handle the function????

      It's kind of a tough call. What I've tried to do in my experience is to stay away from functions specific to one particular database - like UNIX_TIMESTAMP in MySQL. But many people would argue that point, especially if you want to fully take advantage of all that a particular database has to offer. My preference is to stay database independent as much as possible - this makes migration to a different database, at some point in the future, less painful :-)