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. | [reply] |
| [reply] |
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 :-)
| [reply] |