[thelist] date time query

Mark Groen mark at markgroen.com
Thu Jul 29 00:53:35 CDT 2004


----- Original Message ----- 
Sent: July 28, 2004 10:20 PM
Subject: RE: [thelist] date time query


> > I can't seem to get a query to work as expected:
> >
> > INSERT INTO bowenonline (id, datestamp, thread, parent, author,
> > subject, email)
> > SELECT id, CONCAT(postdate + time) AS datestamp, thread, parent,
> > author, subject, email FROM forum;
> >
> > The datestamp field gets populated with the default 0000-00-00
> > 00:00:00 instead of something like 1999-01-01 12:01:01. The
datestamp
> > field is a DATETIME type and the postdate is DATE and time is
TIME.
> > Anything obvious I might be missing here?
>
> Mark,
>
> Hmmm... which database would this be?  One thing to look at would
be the
> CONCAT function.  If you are concatenating the strings with the +
operator,
> I don't see why you'd need the CONCAT method.  Perhaps it should be
> CONCAT(postdate, ' ', time)?  I think you are using MySQL, and I'm
not a
> MySQL guru, but do check that you can implicitly convert between
date and
> time types to string, and back from a string to datetime
automatically like
> this.

Hope you're not right that it might be a limitation of MySQL, seems
so simple... will check.

tia!

cheers,

       Mark



More information about the thelist mailing list