Hello,

Morgan Christiansson wrote:
> 
> > At 07:54 PM 11/17/01 -0200, Manuel Lemos wrote:
> >
> >> - Metabase API already provides true portability to database
> >> applications, so you would not need to crack your head doing what
> >> Metabase already does.
> >
> >
> > Firstly, I can certainly see benefits in using Metabase - to take an
> > example: in a new script I am writing I need to store a lot of dates in
> > a database - Metabase would make it much easier to be cross-database
> > compatible.  I believe date handling hasn't been implemented in PEAR-DB
> > yet?
> 
> IMHO the most portable way of storing dates is to just store them as
> timestamp in an int field.
>
> - php already uses timestamps for storing dates.
> - If you use timestamps in the DB it takes less storage space (at least
> for MySQL).
> 
> possible mysql specific:
> - If you want to display the date witout extra coding in MySQL you can
> use the FROM_UNIXTIME() function
> - If you have a date but want a timestamp in MySQL you can use
> UNIX_TIMESTAMP()

That is not a very good idea because usually integer timestamps have a
limited range of years. In Unix, timestamps can only go from 1970 to
2038.

Metabase uses the ISO-9601 format (YYYY-MM-DD HH:MM:SS) because most
DBMS support it natively. For the other DBMS that do not support it, you
can store it as text and you do not have to make further conversions in
the respective Metabase drivers. Since the format already stores date
parts in descendent order of magnitude (Year, Month, Day, Hour, Minute
and Second) queries that are ordered by that field will show correctly.

Regards,
Manuel Lemos

-- 
PHP Development 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]

Reply via email to